Running Your Unit Tests Continuously

Posted Wed, Sep 26 2012 16:56 by Deborah Kurata

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:

image

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.

Enjoy!

Filed under: , , , ,

Comments

# Test Explorer in Visual Studio 2012

Wednesday, September 26, 2012 7:01 PM by Deborah's Developer MindScape

One of the new things about testing in Visual Studio 2012 is that it is now available in *all* editions

# Interesting Finds: September 27, 2012

Thursday, September 27, 2012 5:51 AM by Jason Haley

Interesting Finds: September 27, 2012

# re: Running Your Unit Tests Continuously

Friday, September 28, 2012 3:43 PM by Steve Greatrex

Check out nCrunch - it runs your tests automatically *as you code*

# re: Running Your Unit Tests Continuously

Friday, September 28, 2012 6:10 PM by Deborah Kurata

Hi Steve -

Cool! Thanks for the suggestion.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: