Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running unit tests on more than five cores in parallel

I've followed the instructions on http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx to the letter and I can execute tests in parallel.

So far so good.

Now the problem: I can't set the parallelTestCount to zero (Auto configure) or to a value above 5. Running five parallel tests works fine but not six.

Yes I have more than five cores on my machine; I am running on an Intel i7 processor which has four cores with hyperthreading meaning I should be able to run 8 tests in parallel.

Now I'm sure there are some other logical or hard limitations and I am not expecting to be able to run on eight cores lightning-speeding eight tests through in parallel.

However it would be cool to know the reason for it not running more than five tests in parallel?

like image 717
noopman Avatar asked Aug 11 '10 14:08

noopman


People also ask

Should unit tests be run in parallel?

Running unit tests in parallel can significantly improve the speed at which they run. However, you have to make sure that one test does not affect another in any way. Else your tests are green most of the time, but sometimes one or more tests will fail.

How many tests will run at a time in parallel execution?

What is Parallel Testing? Parallel testing means running multiple automated tests simultaneously to shorten the overall start-to-end runtime of a test suite. For example, if 10 tests take a total of 10 minutes to run, then 2 parallel processes could execute 5 tests each and cut the total runtime down to 5 minutes.

Can we run tests in parallel?

Parallel Testing is a process to leverage automation testing capabilities by allowing the execution of the same tests simultaneously in multiple environments, real device combinations, and browser configurations.

Can you run JUnit tests in parallel?

Once the parallel execution property is set (or enabled), the JUnit Jupiter engine will run the tests in parallel as per the configurations provided with the synchronization mechanisms.


2 Answers

It seems that this is a bug in MSTest. I have stumbled upon the same problem, all tests are marked as aborted and there is a "Test run error" link in the Test Results window which if clicked yields this message: "Test run is aborting on '', number of hung tests exceeds maximum allowable '5'".

Update: It is fixed in the Visual Studio 2010 Service Pack.

like image 181
HHK Avatar answered Sep 21 '22 08:09

HHK


It could just be me but hyperthreading isn't a real core so an i7 only really has 4 physical cores not 8. Maybe it is something to do with that.

Or perhaps there is some bios setting relating to how the hyperthreading can be used by the OS that is preventing it.

like image 38
Peter Avatar answered Sep 20 '22 08:09

Peter