Breakpoints not hitting Visual Studio Unit Test projects

I’ve switched over to working some software development for the past few months and haven’t been too active on this blog.  Seems that there are plenty of people WAY smarter than me when it comes to coding, so I don’t usually have too much to say about the stuff (other than that I’m a good faker coder).  Anyway, was working on some unit tests for a particular class in my current project and for some reason, breakpoints were never hitting in my tests.  The solution would build without error, but the breakpoints always said ‘symbols not loaded’.

This was really driving me crazy, and since I thought I screwed up the build configuration, I ended up tearing out the test project and putting it back in, with no success.  Then looking at Test Explorer, I noticed that the unit tests were failing.  Looking at the error message, it turned out that the signature the test method with the [ClassInitialize] attribute had an incorrect signature (specifically, it needed to be public static void and have one parameter of the TestContext type).

So, long story short, a bad setup in your unit tests won’t necessarily prevent it from building, but will almost certainly prevent your tests from running.  And the Text Explorer will be more than happily tell you that you are stupid.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: