I am trying to run multiple categories from nunit console. In version below 3.0 i was running it as
nunit.exe "mydll.dll" /run /include=Category1,Category2
I would like to use it similarly using nunit 3.2.0. Any idea how do i use it? I understood that /include option has been replaced in version 3.0 above and should be used as --where. Here is how i am trying to run it.
Below are options tried with no luck.
nunit3-console.exe "mydll.dll" --where:cat==Category1,Category2
nunit3-console.exe "mydll.dll" --where:cat==Category1&&Category2
nunit3-console.exe "mydll.dll" --where:cat==Category1||Category2
can someone help me in executing multiple categories in one go?
To join multiple conditions together, you need each to be an actual condition - so I think you want:
--where:cat==Category1||cat==Category2
Or more readably IMO:
"--where:cat == Category1 || cat == Category2"
The quoting may be necessary to stop the shell from expecting "|" to be important, too.
This works fine for me. Demo:
using NUnit.Framework;
public class TestDemo
{
[Test, Category("X")]
public void TestX()
{
}
[Test, Category("Y")]
public void TestY()
{
}
[Test, Category("Z")]
public void TestZ()
{
}
}
Compile:
csc /target:library /r:nunit.framework.dll TestDemo.cs
Run:
nunit3-console.exe TestDemo.dll "--where:cat==X || cat==Y"
Result:
Test Count: 2, Passed: 2, Failed: 0, Inconclusive: 0, Skipped: 0
See more on this question at Stackoverflow