Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting VSProjectLoader extension as part of dotnet-nunit CLI #1333

Open
amine-aboufirass opened this issue Apr 11, 2023 · 5 comments
Open
Labels

Comments

@amine-aboufirass
Copy link

amine-aboufirass commented Apr 11, 2023

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

@CharliePoole
Copy link
Contributor

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.

@amine-aboufirass
Copy link
Author

@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.

@CharliePoole
Copy link
Contributor

CharliePoole commented Apr 11, 2023

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.

@amine-aboufirass
Copy link
Author

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.

@CharliePoole
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants