nunit-console
nunit-console copied to clipboard
Getting VSProjectLoader extension as part of dotnet-nunit CLI
I recently installed the Nunit console runner as follows:
dotnet tool install -g nunit.consolerunner.netcore
It seems to work fine, but it also requires me to manually list out the files containing the tests which is a bit of a disappointment. I was hoping that it would have some built-in automatic test discovery.
On the other hand, I notice there are extension points on it, and one of the extensions appears to be NUnit.Extension.VSProjectLoader.
However when I tried to install this as a dotnet tool I get an error:
Cannot find a manifest file.
For a list of locations searched, specify the "-d" option before the tool name.
If you intended to install a global tool, add `--global` to the command.
If you would like to create a manifest, use `dotnet new tool-manifest`, usually in the repo root directory.
Is there a way to get this extension as part of a global install of the dotnet-nunit CLI tool? I would prefer not to modify my source code.
Thanks
You may want to try the full NUnit console runner rather than the dotnet tool version, which is more limited.
The full runner executes under the .NET Framework, but launches processes as needed to run under .NET Core. The dotnet tool runs under .NET Core 6.0 and runs tests in-process. Although it supports extensions, most extensions have not been rewritten to run in a .NET Core process.
@CharliePoole Thanks for your response. But with the console runner I would have to modify my Visual Studio project files would I not?
The advantage of having a full featured dotnet tool is that it doesn't force the user to modify individual files.
Please explain. You haven't said why you believe you would need to modify your project files and I can't think of a reason. That said, I can't guarantee that the VS Project Loader extension will work with your project files, since it has not been updated for a while. The easiest way to find out is just to try to run the tests using it.
You may want to try the full NUnit console runner rather than the dotnet tool version, which is more limited.
This is the full NUnit console runner, if I'm not mistaken.
It looks like that's installed using dotnet add package, and dotnet add package can only be made in conjunction with a project file. It's basically a shorthand way of adding a PackageReference element to said project file.
If I'm working on a thirdparty code base and want to test it, I'd rather not have to change the project files like that.
OK, I see that is confusing. Of course the "how to install" info on nuget doesn't tell you anything about how to install a tool outside of nuget. All the nuget approaches modify the project.
My favorite approach for a global install of the console runner is to use chocolatey. Both the runner and the supported extensions are available on chocolatey.org. If you have chocolatey installed, just use choco install nunit-console-runner for the runner and choco install nunit-extension-vs-project-loader for the project loader extension. By using chocolatey for both runner and extensions, the extensions are findable by the runner.
In addition, if you look at the project releases on github, you will also find .zip and .msi files through version 3.16.2. They appear to be missing in 3.16.3.