Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to Ignore NUnit's Ignore attribute
msorens
#1 Posted : Tuesday, July 2, 2013 12:55:33 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/2/2013(UTC)
Posts: 1
Location: United States of America

I have yet to find a way to do this, but I am hoping it is possible:

Out of a large suite of NUnit tests, I want to satisfy these two constraints:
1. All tests should run when I am engaged in using Visual Studio/NCrunch.
2. Most tests should run on my build machine, i.e., there is a small number of tests that should not run.

In order to satisfy (2), I use NUnit's Ignore attribute. But NCrunch honors that attribute and also does not run those tests, violating (1).
I was experimenting with engine modes to see, for example, if I specify a particular category that might override the Ignore attribute, but apparently NCrunch considers Ignore first.

Is there any way to make NCrunch run test's decorated with Ignore ?
Remco
#2 Posted : Tuesday, July 2, 2013 2:10:03 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Not directly - but there may be other ways to achieve your objectives.

One way is by using categories. The ease of this may depend upon how you are executing tests on your build server, but if you attribute all tests that should run on the build server with a specific attribute (i.e. [Category("BuildServer")]), you can then selectively run only these tests on the build server without needing to ignore them.

Another option is to use conditional compilation to switch off the Ignore attributes for the NCrunch test environment. For example:

#if !NCRUNCH
[Ignore]
#endif

.. You may find this more useful if you are trying to exclude a small minority of tests, as you'll need to touch less code in order to implement it.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.023 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download