Excluding NUnit categories?
Excluding NUnit categories?
Hi there
I'm new here and I'm not sure if this topic has been discussed yet, I haven't found it in the existing topics...
Is it possible to exclude certain categories of NUnit tests (e.g. tests like [Test, Category("Performance")]) in an NCover project? So for example performance tests, which I don't want to execute daily...
Thank you in advance
RE: Excluding NUnit categories?
Hi Beeeni,
Thanks for your question.
It's common to exclude the entire NUnit test DLL by adding the exclude assembly argument -- //eas UnitTest, for example -- to your NCover command line. Here's a link describing that syntax:
http://docs.ncover.com/ref/3-0/ncover-console/command-line/profiling-options#ias
If you're using the NCover Explorer, go to Application Options > Project Settings > Runtime Excludes, where you'll see "Assemblies" at the top of the tab.
Enter the name of your DLL without the extension -- like "UnitTest" -- then close the window and run coverage again. NCover should profile all assemblies except the one you specified.
If you only want to exclude certain test methods, you can use em// .*\.TestMethod, as an example:
http://docs.ncover.com/ref/3-0/ncover-console/command-line/profiling-options#em
Or, you can paste the regex only into Application Options > Project Settings > Runtime Excludes.
I hope this helps!
Best Regards,
NCover Support
RE: Excluding NUnit categories?
Hi rhinson
Thanks for your quick response. Actually I found out how to exclude NUnit test categories in NCover: I just add the NUnit-Console option /exclude="Performance" to the applications argument list for excluding the category "Performance"...
Best regards Beeeni
RE: Excluding NUnit categories?
Hi Beeeni,
I'm glad you found your own solution, and thanks for sharing that NUnit argument.
I typically make recommendations about how to exclude code from profiling at runtime, but I understand that not running the Performance category at all is more useful to you -- that's a handy option.
Best Regards,
NCover Support