Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude tests from a certain category

Tags:

ncrunch

"Bottom" line: How do you set up NCrunch to exclude all tests in a certain category, e.g. "LongRunning"?


Stack Overflow search provided zero results, and the relevant NCrunch wiki page merely informs me that "NUnit's Category attribute is just as powerful as NCrunch", which is nice but doesn't tell me how to use those categories.

To further clarify, I was expecting a checkbox-list somewhere to turn categories on/off, similar to the /exclude option in the NUnit Test Runner to exclude all tests in certain categories.

PS. I've tagged the question only with NCrunch, it didn't seem relevant that I'm using NUnit as my testing framework. Should the answers indicate otherwise I'm happy to add the tag.

like image 599
Jeroen Avatar asked Sep 25 '12 09:09

Jeroen


1 Answers

After some more searching on the wiki I found this page describing it: you need to create a new Engine Mode. Who would've thought?

Here's the two relevant steps/screenshots that got this working for me. First, go to the NCrunch menu, choose "Set Engine Mode" and then "Customise Engine Modes...":

Step 1 - enabling custom engine

And then step 2, choose "Run all tests automatically + CATEGORY FILTER", click "Add Engine Mode". Then give it a name, and add a condition "does not have category" and choose your category to ignore, e.g. "LongRunning". Then hit "OK":

Step 2 - add custom engine with filter on "not in category"

Finally choose the new engine and your tests are filtered!

like image 169
Jeroen Avatar answered Jan 06 '23 07:01

Jeroen