user623566
user623566

Reputation:

How to Make a test method Not Runnable in Visual Studio Unit Test

How to Make a test method not runnable in Visual Studio Unit Test ? using visual studio 2010 with .NET 4.0.

Suppose I have 10 test methods out of which, 1 test method is not working due to external dependencies. If I want to run all 10, then I will get error in one test.

One solution is: Don't run the test. But I need to know, is there any Attributes or anything like that, which simply bypasses the test and it will not be run.

I tried with [WorkItem(1234)] Attribute, but still the test is running.

Any help is greatly appreciated.

Upvotes: 9

Views: 6690

Answers (1)

Belogix
Belogix

Reputation: 8147

Yes, you can add the Ignore attribute to the test you want to skip:

[TestMethod, Ignore]
public void ThisTestWontRun()
{
    // Test code here
}

Upvotes: 29

Related Questions