Use NUnit Console Runner to run all of the test projects under a VS solution

117 Views Asked by At

My VS Solution consists of production code and also test code, properly separated into different csprojects. It's always one to one correspondence between a production project and a test project.

Is there anyway to run all the test projects under that VS Solution on nunit3-console ? I prefer to just pass in the Solution to the NUnit console runner, without me having to create a NUnit project, or manually pass in all the test projects.

1

There are 1 best solutions below

0
Charlie On BEST ANSWER

NUnit3-console can run the tests in a VS solution if you have installed the Visual Studio Project Loader extension. If it is installed, you can run

nunit3-console MyProject.sln --skipnontestassemblies

and the extension will locate all the projects in the solution and load those with extensions (e.g. .csproj) it knows about. The --skipnontestassemblies option is used to avoid error messages about assemblies, which do not contain tests.

If you installed from the msi package, you already have the extension installed. If you installed using nuget or chocolatey, get the extension package on either of those sites or using the commandline. The Nuget package id is NUnit.Extension.VSProjectLoader. The Chocolatey id is nunit-extension-vs-project-loader.