Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nunit3 how to include test category in command line

Tags:

nunit

nunit3-console TestData.dll /include:SmokeTests

but with nunit v3 I get back:

Invalid argument: /include:SmokeTests

I try to check command line parameters here http://nunit.org/index.php?p=consoleCommandLine&r=3.0

but page does not exist. Anyone know what has changed?

like image 791
senzacionale Avatar asked Dec 05 '15 10:12

senzacionale


People also ask

How do I use nunit3 console?

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.

What is category attribute in NUnit?

The Category attribute provides an alternative to suites for dealing with groups of tests. Either individual test cases or fixtures may be identified as belonging to a particular category. Some runners, including the Console Runner, allow specifying categories to be included in or excluded from the run.


2 Answers

So if anyone searching how to do this in NUNIT3:

 --where "cat == SmokeTests" --noresult

helped by @omer727 link!

like image 154
senzacionale Avatar answered Oct 11 '22 14:10

senzacionale


Link provided by @omer727 is broken, here is another one: https://github.com/nunit/docs/wiki/Console-Command-Line

The anwser still works:

--where "cat == SmokeTests"

The console command-line allows you to specify a filter, which will select which tests are executed. This is done using the --where option, followed by an expression in NUnit's Test Selection Language (TSL), a simple domain-specific language designed for this purpose.

Example:

nunit3-console mytest.dll --where "cat == Urgent || Priority == High"

For more details visit this link: https://github.com/nunit/docs/wiki/Test-Selection-Language

EDIT:

The detailed example can be found in the related SO question here.

like image 44
Evgeniy Kosjakov Avatar answered Oct 11 '22 15:10

Evgeniy Kosjakov