tags:

views:

505

answers:

6

I can add an attribute on a test to ignore it

[Test]
[Ignore("Foo Bar")]

Is there anyway to ignore all tests in a file (at the TestFixture level) ?

A: 

Simply don't apply the TextFixture attribute on the class.

J.W.
By not applying the attribute you're ignoring the fact that there are test methods within this class that aren't being tested for a reason. You should use [TestFixture, Ignore("reason")] to supply the output of the test results with a reason why they're ignored. Deleting/removing it is obfuscating the reason altogether when it probably makes sense to convey this to other developers.
Chris Missal
+1 @Chris...Ignore attribute conveys purpose much more clearly.
KG
+1  A: 

Removing the [TestFixture] attribute from the class seems like it would work.

Jason Punyon
A: 

Comment out the attribute

feihtthief
+1  A: 

You can make the whole TestFixture "on-demand" by using the [Explicit] attribute. Then it's there when you want it, but only when you explicitly click on it.

jcollum
+3  A: 

As suggested, the [Explicit] attribute works well. You can also simply place the [Ignore()] attribute under the [TestFixture] attribute, as shown in the documentation:

http://www.nunit.org/index.php?p=ignore&r=2.5

Use [Ignore()] if you want the test to be flagged as ignored (and therefore you get the yellow bar if all other tests pass). Use [Explicit] if you want the test to be completely discounted (and therefore you get the green bar if all other tests pass).

Thorin
+19  A: 
[TestFixture, Ignore("reason")]
Chris Missal