Running Your Unit Tests Continuously
Wed, Sep 26 2012 16:56
One of the new unit testing features in VS 2012 (Premium or Ultimate) is the continuous test runner. When turned on, it automatically executes your unit tests after every successful build.
Digressing a moment … in the early 1990's Shari Lewis and Lamb Chop would sing a version of "The Song that Never Ends" at the end of each episode of their show. In memory of Lamb Chop:
It is the test that never ends.
It goes on and on my friends.
Someone starting running it not knowing what it was,
and they'll continue running it forever just because… <repeat>
To turn on the continuous test runner, select the icon in the upper left corner of the Test Explorer:
The tests will automatically execute asynchronously after each build. They also automatically run when first opening a solution containing the tests.
NOTE: The tests are not executed after a build that is part of a Start With Debugging (F5) or Start Without Debugging operation.
Any failed tests from previous runs are executed first. If they pass, the other (previously passed) tests are executed. If they fail, the other (previously passed) tests are not executed.
This last point has caused me problems. I made a change that would have caused a previously passed tests to fail but I was not notified because I have some other failing tests. I had to manually run the tests in order for the previously passed tests to fail appropriately.
Use the search feature of Test Explorer (detailed in this prior post) to filter the list of tests to execute.