Visual Studio 2010 does not detect new unit tests

I am writing some unit tests in Visual Studio 2010. I can run all tests using Run All Tests in Current Context.

However, if I write a new unit test, it is not picked up by the environment - in other words, I can not find it in the test list editor, running all the tests or elsewhere. If I unload the project and then reload it; A new test is available to run.

When I add a unit test, I just add a new method to an existing TestClass and decorate it with the [TestMethod] attribute - nothing unusual.

What could be causing this behavior, and how can I make it work?

+44
unit-testing visual-studio visual-studio-2010 mstest
Apr 15 2018-10-15T00:
source share
4 answers

I finally understood the problem. In the "Parameters" section of "Testing Tools" → "Test Project" there is an option "Disable the background detection of test methods." It was turned on - I do not know how this happened, but removing the checkmark and restarting Visual Studio solved the problem.

+73
Apr 26 '10 at 12:40
source share

I also had this problem when building in debug mode. When I switched it to create a release mode that fixed it for me.

+3
Apr 23 '10 at 21:51
source share

I had a similar problem in Visual Studio 2012, however none of the solutions worked. I am developing a 64-bit application, and the solution was to choose: -

Test -> Test Settings -> Default Processor Architecture -> X64 
+1
Apr 09 '15 at 13:50
source share

I had this problem and option 2 below fixed it for me.

  • Delete any app.config file (not sure why, but on one of the MS forums there are several such posts with this solution) and

  • Make sure that the project is configured to build in the configuration properties of the solution!

0
Jun 16 '14 at 13:04 on
source share



All Articles