Share via


“Run Tests in Current Context” after upgrading from Visual Studio 2010 Beta2

If you have upgraded from Visual Studio 2010 Beta2, you may have noticed that when using the Visual Studio IDE to run your tests, "Run Tests in Current Context" (Ctrl+R, T) sometimes runs all tests in your solution, rather than just the tests in context.  This can be really annoying if you have a large number of tests in your solution!

About to "Run Tests in Current Context". Only TestMethod1 should be executed.

Both tests were executed, even though only TestMethod1 was in context!

It turns out that this is caused by a change that was made in Visual Studio 2010 RC to the way Test Settings files are stored.  You can fix the issue by opening each Test Settings file (*.testsettings) contained in your solution, making a trivial change, and saving.

Test Settings Editor

When you first open this editor, the "Apply" button will be disabled.  To enable it, just append a character to the end of the Description field, and then delete that character; effectively you will have not made any changes to the Test Settings.  When you click the "Apply" button, the test settings will be saved to disk in the correct format.  If you do this for each of your Test Settings files (not just the “active” settings), “Run Tests in Current Context” should once again reliably run the correct set of tests.

Regards,

Neal Fowler

Comments

  • Anonymous
    October 08, 2012
    The exact same problem happens to me, but there are no .testsettings files anywhere in the solution tree. Any other suggestions? Thanks.