Build/Test Issues

Selecting test categories using console tool

Started by username on 4,092 views

Using the console tool I can build and execute the tests in the solution:

> NCrunch.exe "\mysolution.sln" -MaxNumberOfProcessingThreads 8 -FastLaneThreads 0

I can't figure out how to execute a subset of the tests based on test category.

In the visual studio plugin it looks like this is achieved using engine plans. But I can't find any documentation on how this is done with the console tool. I guess it is the same way but can't figure out how to select an engine mode through the console tool.

It seems a bit odd achieving this through the engine mode because:
a) it seems you can only edit this through the VS plugin (when you want to use the console tool)
b) the engine has settings that apply to continuous execution contexts and would presumably be ignored in the console tool.

Many thanks in advance for any help with this,
Barry
Hi Barry,

Thanks for posting!

Under NCrunch V2, it is only possible to do this using engine modes. This is because the test filters themselves can be attached only to the engine modes. It's possible to choose an engine mode using the '/E' parameter (try '/?' for more information on how to do this).

in NCrunch V3, engine modes were rewired so that instead of being a separate settings system, they are now overrides for other settings. See Advanced Configuration for more details about this. Basically, this means you can now inject the filter straight into the command line. For example:

NCrunch.exe "\mysolution.sln" -MaxNumberOfProcessingThreads 8 -FastLaneThreads 0 -TestsToExecuteAutomatically "HasCategory 'My Category'"

For examples on how to specify this filter, you can create it using the NCrunch Configuration Window, then inspect your configuration files to see the syntax. The syntax accepted by the console tool is always the same as is written in the config file.
Works a charm thank you.

Post a reply

Log in to reply.