Geeks With Blogs
Tim Huffam Dotting the I and crossing the T of I.T.

When workig on a project in VS2010 and performing a "run tests in context" the debugger was catching and halting on a test that fails, raising the exception AssertFailedException.  I thought this was strange as the same test (in fact any test) that failed in VS2008 would simply just be noted in the test results as Failed...

Turns out it's the way I've been running tests..

Both VS2008 and VS2010 have the same shortcut mappings:
- "ctrl-r, t" for "Run tests in context"
- "ctrl-r, ctrl-t" for "Debug tests in context"

I've always done "ctrl-r, ctrl-t" - holding down ctrl then pressing r, releasing r then pressing t (while still holding down ctrl) then t then releasing ctrl.  This is actually "ctrl-r, ctrl-t".. so should have been invoking "debug tests in context" - but in VS2008 it was not detecting that I was holding down the ctrl when pressing t.

So, now that vs2010 is properly detecting the ctrl key, its running "debug tests in context" (as it should), hence I'm seeing the AssertFailedException being caught by the debugger instead of just failing the test.

So the solution is for me to use the proper shortcut to "Run tests in context" which is": "ctrl-r, t" - hold down ctrl, press r, release r and release ctrl, then press t (by itself).

HTH
Tim

Posted on Wednesday, July 28, 2010 9:18 PM BizTalk , C# .NET , ASP.NET , Unit Testing , WPF & Silverlight | Back to top


Comments on this post: VS2010 debugger catching AssertFailedException instead of running and failing tests

# re: VS2010 debugger catching AssertFailedException instead of running and failing tests
Requesting Gravatar...
CTRL-R + T = Run test in context. This can easily be triggered inside a test. CTRL-R + A = Run all tests.
Left by Itchy Skin Bumps on May 10, 2011 3:13 AM

# re: VS2010 debugger catching AssertFailedException instead of running and failing tests
Requesting Gravatar...
Interesting method! I have always used ctrl-t or ctrl-r+a for running all tests in the context. Thanks for the good advice, now it is very easy for me to run only one test :)
Left by Integrated Marketing Solutions on Jan 19, 2012 4:54 AM

# re: VS2010 debugger catching AssertFailedException instead of running and failing tests
Requesting Gravatar...
That is sugary. I did so possibly not realize which will I'm also able to use this. As i vital ones telephone additionally investigated the more than even so it is fine remarkably. I`m because of this over the moon that should We came onto your website.
Be aware.
Left by Android Instagram on Apr 10, 2012 12:52 PM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net