2

After pouring over the NUnit 3 documentation on Test Selection Language and trying a few combinations, I still cannot figure out how to run all the tests within a specific namespace.

The most obvious attempt being:

nunit3-console.exe --where "test == 'MyNamespace.Subnamespace'" Tests.dll

Unfortunately, this reports zero matching tests, although using the --explore options I can see many tests within that namespace.

Do I need to use regular expression/wildcards to accomplish this? The NUnit docs hint otherwise, but given this doesn't work maybe I do.

Jack Ukleja
  • 13,061
  • 11
  • 72
  • 113

1 Answers1

3

It seems the following works:

nunit3-console.exe --where "test =~ 'MyNamespace.Subnamespace'" Tests.dll

Note the squiggle =~ is a regex operator.

This is a bit of a surprise because the only example mentioning namespaces in the documentation uses the == syntax which, given my original experimentation, would not have any effect.

Jack Ukleja
  • 13,061
  • 11
  • 72
  • 113
  • 1
    The original works (for me) as well. You haven't indicated what version of the nunit3-console runner you are using. Perhaps you have an older one? – Charlie Oct 13 '16 at 19:04
  • 1
    Regarding the docs... they mention that you can give the name of any test. I suppose it may not be clear to all readers that a namespace containing tests __is__ a test, just the same as a class containing tests. That's a general feature of most testing frameworks implemented using the Composite pattern. – Charlie Oct 13 '16 at 19:06