9a3eedi
9a3eedi

Reputation: 728

Listing test results in VS2010 that DONT include a keyword

Is there any way I can filter test results by specifying a keyword that should NOT appear?

Context:

I've written some C# classes and methods, but did not implement those methods for now (I made them throw a NotImplementedException so that they clearly indicate this). I also written some test cases for those functions, but they currently fail because the methods throw the NotImplementedException. This is ok and I expect this for now.

I want to ignore these tests for now and look at other test results that are more meaningful, so I was trying to figure out how I can list results that do not have the "NotImplementedException". However, I can only list the results that do have that keyword, not those that don't. Is there any way I can list the results that don't? Using some wildcards or something?

I see a lot of information about the new Test Explorer in VS2012, but that's not a feature in 2010, which is what I'm using.

Upvotes: 1

Views: 47

Answers (2)

chaliasos
chaliasos

Reputation: 9783

I also written some test cases for those functions

If your tests are linked to Test Cases work items on TFS you could simply set the Test Case's State to Design. Then, on your Test Plans exclude all test cases that are on Designed state.

If they are not linked to actual Test Cases work items (let's say a batch of unit tests), I believe the best solution is the Ignore attrbute (as @Serv already mentioned). Because I don't think you want to run tests that are not implemented yet and also waste time to find out how to exclude them from test results.

Upvotes: 0

Marco
Marco

Reputation: 23937

You can sort of cheat to pass this tests, if you want to, by marking that this test expects an exception to be thrown and thereby passes the test.

[TestMethod]
[ExpectedException(typeof(NotImplementedException))]
public void NotYetImplementedMethod(Object args)
{
    ....
}

Alternatively you can create categories for your tests. This way you can choose which tests to run in the Test explorer, if you assign a category to most of your tests.

[TestMethod]
[Testcategory("NotImplementedNotTested")]
public void NotYetImplementedMethod(Object args)
{
    ....
}

Last but not least the simplest solution [Ignore]. This will skip the tests alltogether.

[TestMethod]
[Ignore]
public void NotYetImplementedMethod(Object args)
{
    ....
}

Reference:

Upvotes: 1

Related Questions