Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSTest Run Ignored Tests (VS2013)

I've recently starting using VS2013 (was previously using 2010).

I no longer seem to be able to run ignored tests by either using Resharper or the Visual Studio test runner. This is how I am declaring test methods:

[TestMethod, Ignore]
public void TestMethod()
{
    // Do something
}

I used to be able to previously run tests like this manually? Has this functionality been removed?

NUnit's Explicit attribute still works fine.

Thanks

like image 934
RagtimeWilly Avatar asked Nov 18 '14 01:11

RagtimeWilly


1 Answers

Because the compile makes the ignore part of the source code you cannot run tests that have been ignored from the MSTest test runner. If you want to have conditionally executed tests, you have a few options.

  1. Create a new build configuration, and set a compiler directive. Include the ignore unless/only when the directive is set (depending on your usage)

  2. Disable the tests, but do not "ignore" them. Disabling means the test can be manually run, ignoring means they cannot.

  3. Create a new "ignored" test category, and exclude that from your builds/other testing runs. Then just include that category locally.

Hopefully one of these three would work for you. Kind of depends on what your setup is, and the reasons you are ignoring/not ignoring these tests.

like image 50
Tim Avatar answered Nov 06 '22 20:11

Tim