The Reason for the different test settings in Visual Studio 2010

There are different test settings for debugging tests and running code coverage and the like in Visual Studio 2010. When you want to run code coverage you cannot

Yesterday I blogged Make sure you edit the same test settings that you use in Visual Studio 2010. I couldn’t figure out why there were two default sets of test settings in Visual Studio 2010; “Local” and “Trace and Test Impact”?

Now I know better.

After my debacle with the different test settings I promptly deleted the “Trace and Test Impact” settings and kept only the “Local” settings. YAGNI – right? Wrong!

Today I had to begin debugging a test case. Usually under TDD when you have flow there is very little actual debugging going on. You just run the tests to make sure you are developing right. But now I had to debug.

When hitting <ctrl>R + <ctrl>T in Visual Studio you run your “tests in the current context”. This is what I did. And then I get the (pretty familiar?) prompt “Debugging test running on a remote computer or with code coverage enabled is not supported. The tests will run under the debugger locally and without code coverage enabled.” Wonder why there is only one error message for two kinds of errors? Is it not possible to see that my case is that of code coverage error and not remote debugging?

codecoveragedebugger

Checking “Do not show this dialog box again” and hitting OK at least removes the dialog.

Note: Do you know where you can enable this dialog again? Neither did I! ;~) This is done under Tools –> Options –> Test Tools –> Default Dialog Box Action –> “When starting a remote test run or a run with code coverage under the debugger:” –> Flip “Don’t prompt” to “Always prompt”. There are lots of other dialogs you can fiddle with too.

What was worse I couldn’t even get my test to run. Instead I got the test result to say “Not Executed”.

codecoveragedebugger3

Needless to say this was not what I was aiming for. And this is also what the different sets of test settings are targeting!

Now I added back the second set of test settings (thank you subversion) and enabled Code Coverage for this set of settings only.

The result is:

My Local settings run debugging without problems.

When I want to run Code Coverage I flip over to my other set of settings and run my tests for code coverage.

Added bonus is of course that each test run I run don’t always calculate the Code Coverage. Didn’t think of that before.

The only irritation now is to have to switch Active Test Settings when I am flipping between debugging tests and code coverage.

HTH – Cheers,

M.

This work is licensed under a Creative Commons license.

posted @ Tuesday, June 23, 2009 12:09 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 7 and type the answer here:
 

Live Comment Preview: