Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Individual Test from Nunit3-console.exe

when i run

nunit3-console.exe (myfilepath)\dll file

The Console Runner Runs all my tests.

what command do i need to run in order to run individual tests? i tried

nunit3-console.exe  /run:namespace.class.method (myfilepath)\dll file

it says that I am using an invalid argument. can someone provide me with the correct syntax?

THanks

like image 992
Andy Williams Avatar asked May 18 '16 11:05

Andy Williams


People also ask

How do I use nunit3 console exe?

Open a powershell window and run nunit3-console.exe with "--test" option set to reference the specific test you want to run (including namespace and class). and finally, provide the location of the assembly where the test can be found.

How do I get NUnit-console exe?

The preferred way to download NUnit is through the NuGet package manager. The latest releases of can always be found on the relevant GitHub releases pages.

How do I run NUnit tests from command line in Visual Studio?

Use nunit-console.exe to run tests from the command line. This will run the unit tests and save the results in the results. xml file, which you can work with easily.


1 Answers

You want to look at the --where command line option to run individual tests or filter your tests. It is new for NUnit 3. The --where option uses the test selection language which is a little bit like SQL for tests.

nunit-console --where "method =~ /Source.*Test/ && class =~ 'My.Namespace.Classname'" test.dll

For simple filters, you can also use the --test=NAMES option with a simple list of test names separated by commas.

nunit3-console.exe --test=namespace.class.method test.dll

With TestCase and other data driven tests, the test name for individual tests can be difficult to determine. If that is the case, you can use the --explore option.

like image 120
Rob Prouse Avatar answered Oct 22 '22 07:10

Rob Prouse