paralel

Let’s dig further into why the parallelism is not achieved yet.

The reason for this can be found in the Visual Studio Update 1 release notes:

Parallel test execution leverages the available cores on the machine, and is realized by launching the test execution engine on each available core as a distinct process, and handing it a container (assembly, DLL, or relevant artifact containing the tests to execute), worth of tests to execute.

One of the ways to overcome this is to create multiple test assemblies:

solution_structure

Each project contains only one test that is calling methods from the previous one that we used for serial and performs the Assert.

Now if we select and run all the tests from the Test Explorer window, we’ll see that multiple instances of the browser are opened and the parallelism is achieved.

And, the most important thing, the test duration has decreased considerably, from 90 to 30 seconds.

paralle_duration.png

Another way, that’s easier and less messier would be to use Microsoft’s CSC Task in order to split your test project into multiple DLLs. While you’ll most likely need to have multiple test classes, this will get rid of the condition to have multiple test projects in your solution.
For example:

csc /t:library /out:Test1.dll Tests.cs

compiles Tests.cs to Tests1.dll.
Curious how others managed to overcome how the parallelism works in MSTest. Let me know in the comments.