Running unit tests can take some time – at Typemock we have about 4,000 unit tests and running them takes 15 minuets. If you always wished it to take half the time (or a quarter of the time) – wait no more!
Visual Studio 2010 has a hidden feature called parallel test execution – which means that you can run four tests at the same time on your quad core.
Before you start make sure you don’t have any data collection/profiler active.
Just go to the test settings (Local.testsettings file) under Data and diagnostics and make sure that nothing is enabled.
Now for the fun part:
Right-click on the settings file (again Local.testsettings) and select “Open With…”
From the dialog select “XML Editor”
Add ParallelTestCount attribute to the Execution element. You can set a specific number of processors or use 0 to specify that the tests will run on all of the processors available.
Don’t forget to save the file.
You’ll need to close and re-opne the solution in order for the changes to load.
You’ll need to manually set parallel test count each time you update the settings through the UI – because Visual Studio rewrite the file each time the settings are changed.
Hopefully by the time Visual Studio 2010 will be officially released we can activate this feature from the test configuration UI and won’t need to mess with XML.
Labels: MSTest, Unit tests, Visual Studio 2010