views:

235

answers:

7

As our unit test numbers increase we are finding it increasingly difficult to continually run all the tests on our developer machines. Does anyone know if Visual Studio 2008:

  1. natively targets multiple cores
  2. doesn't target multiple cores automatically, but it's configurable
  3. doesn't target multiple cores at all
A: 

You don't mention what test framework you are using, but if you are talking about cppUnit or the like, then its (3), the framework that doesn't target multiple cores at all.

You would have to put some work in to get a unit test application based on an xUnit framework to target multiple cores, (ie uses multiple threads), or write your own framework that does it.

quamrana
+1  A: 

Visual Studio MSTEST will run the tests one at a time.

We run our tests from a match file using MSTEST.

What you could try is to spilt your tests into more that one dll. Then open a cmd window for each test dll, and start the tests from a batch file.

This should allow you to run tests in parallel. Each copy of mstest may run on a different CPU if you are lucky :)

Shiraz Bhaiji
Do you mean batch file?
Chris Arnold
Yes, one for each dll, type "mstest /?" to see which parameters you need
Shiraz Bhaiji
A: 

I can't directly answer your question as I don't have internal knowledge on the product but you may be interested in the Rig type setups where you can scale out machines with Test Agents to execute tests in parallel:

Controllers, Agents, and Rigs

Ed Glas's blog on VSTS load testing

John
A: 

The traditional approach to unit testing, does not scale to address potential concurrency problems that arise in concurrent processes on multiple cores. You will need a specialized tool to reproduce the relatively rare and hard to reproduce error conditions that can arise (Heisenbugs). See this blog post by James Reinders for more information. An example of such a tool for .NET development is CHESS from Microsoft research. Some googling will reveal others that are appropriate for your scenario.

cdiggins
+2  A: 

Tests are run in a single thread, so only one core is used. This is the desired behavior, as having them run on more threads might cause the tests to behave unexpectedly if you're using static variables, or any type of global state (for instance, a test changes a static variable, and when it ends changes it back. If another test is running at the same time, it might see a different value than it expects).

Doron Yaacoby
A: 

You could switch to MbUnit, it has supported parallel test execution for several months now.

Mauricio Scheffer
+1  A: 

It should be noted that with the release of Visual Studio 2010, MSTest now supports running unit tests in parallel. See this blog post on the Visual Studio Team Test blog for more details.

Drew Marsh