When starting a Nunit project from the command line, searches for files along the nunit3-console path

28 views Asked by At

I run tests with the command:

C:\Users\user\NUnit.Console-3.17.0\bin\net6.0\nunit3-console.exe C:\Users\user\source\repos\mmfo_autotest\RegressionTestSuite\bin\Release\net6.0\Regression_Test_Suite.dll

and I get an error:

System.IO.FileNotFoundException : Could not find file 'C:\Users\user\.nuget\packages\nunit.consolerunner\3.17.0\tools\agents\net6.0\appsettings.json'.

But the appsettings.json is in the project root folder C:\Users\user\source\repos\mmfo_autotest\RegressionTestSuite\bin\Release\net6.0\appsettings.json

Code to process the file:

string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
string text = File.ReadAllText(path);
_configuration ??= JsonConvert.DeserializeObject<ConfigurationData>(text);
return _configuration;

The same situation with the selenium-manager. Looks for this file in the nunit3-console path. Although it is and should be located in the root folder of the project.

----> OpenQA.Selenium.WebDriverException : Unable to locate or obtain Selenium Manager binary at C:\Users\user\.nuget\packages\nunit.consolerunner\3.17.0\tools\agents\net6.0\selenium-manager\windows\selenium-manager.exe

How to make the selenium-manager and appsettings.json searched in the root folder of the project?

Versions: NUnit - 4.1.0 NUnit.ConsoleRunner - 3.17.0

0

There are 0 answers