Visual Studio 2010 unit testing windows and running tests in general

I am writing and running my tests on VS2010 using mstest. When I want to run a test or entire tests in a class, sometimes Visual Studio decides to run all my tests.

Why? How can i avoid this? Any tips?

+4
source share
5 answers

Perhaps this is the same problem as VS2008, where if you use the launch context (Ctrl + R [Ctrl +] T) or run the class (Ctrl + R [Ctrl +] C), it acts as if you used run all (Ctrl + R [Ctrl +] A) the first time after opening a solution? Or at least it seems to me. In VS2008, I just stop the test run when I see this, and restart the same operation. Then it usually works "as advertised."

I don’t know if and how this can be related to VS2010 at all at this stage ...

+1
source

right-click in the body of one test and select "run tests" to run this test

0
source

I have the same problem. My workaround for now:

  • Open the test list editor.
  • Enter the name of the test method in the filter field and filter it.
  • Check the tests you want to run.
  • Right-click and select Run Tested Tests

But I prefer to run as advertised if it works, of course. I am open to other best solutions.

0
source

Not quite sure if this applies to VS2010. In VS2008, running tests in the current context sometimes runs all the tests in a solution. It seems that the context is determined by which element was last activated (usually with the mouse). If the last window is selected, these are code windows containing the unit test source code, then all tests in this class / file are executed. Same thing with selecting a file (unit test -) in the solution explorer. If, however, the last time other windows were selected (for example, breakpoints), then the context is the whole solution.

0
source

All Articles