views:

330

answers:

1

...except it isn't missing. I just wrote it, decorated it with [TestMethod] and can see it right in front of me and it compiles. It just doesn't show up in the test results window when running all the TestMethods in the containing TestClass. Or when my cursor is on it making it the only test in the current context. In that case, all the other tests in the class will run but not the new one.

If I close the solution and reopen it, it will run and show up in the test results.

Conversely, if I remove a test from a TestClass, the test results window warns me that the test is missing... well no, I took it out and I don't miss it at all because I wanted it gone.

This wasn't happening yesterday. I've had it happen before in different projects/solutions.

Am I the only one? Is it just a bug in VS with no hope of being remedied by my intervention?

+1  A: 

womp pointed me in the right direction. Building in Release mode solved the problem. It's still a minor hassle, but better than closing and reopening the solution.

@womp, if you're following this question post your suggestion as an answer and I will select it.

Edit: There have been some subsequent indications that the workaround came from toggling between Debug and Release, not necessarily being in Release configuration. Still going to accept because it seems clear that there is not a user-configurable choice being overlooked.

I Have the Hat
I have had that happen to me once in a while, although not on a permanent basis. VS definitely ought to be able to pick up your new unit tests no matter which Build Solution you are using. If this keeps up, I'd suggest filing a bug on Microsoft Connect.
Mark Seemann