Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

VS2015 Update 1 Brings (Back) Parallel Test Execution

DZone's Guide to

VS2015 Update 1 Brings (Back) Parallel Test Execution

The new Visual Studio Update adds new testing functionality to use with your IoT devices and apps.

· IoT Zone
Free Resource

Address your IoT software testing needs – improve quality, security, safety, and compliance across the development lifecycle.

Yesterday I’ve installed the new VS2015 update and tried to make my machine talk to my win10 (IoT core) Raspberry PI. It didn’t help but that’s a story for another blog post. (Spoiler: it was a problem with my laptops Ethernet port.)

After the dust settled I’ve started reading about the new goodness that was just added to my trusty Visual Studio and found out that Microsoft has decided to give us the parallel test execution.

It all started back in the long forgotten Visual Studio 2010. Back then we had a great feature called parallel test execution. It did exactly that – reduce run speed by utilizing several cores to run tests — it was well hidden but for those of use who know where to enable it — it worked like a charm — as long as other tools, especially your Mocking framework of choice supported multi threading.

Then came VS2012 and the ability to run unit tests side by side disappeared… you could use it but for the price of using the old soon to be legacy test runner.

Since I liked the fact that my test run took less time I was happy to see that the feature I liked came back.

Enabling parallel tests is simple — first create a new test.runsetings — don’t look for a template (because there is none), just add a new xml file and rename it.

For parallel tests you just need the file to contain the following lines:

<?xml version="1.0" encoding="utf-8"?><RunSettings>  <RunConfiguration>    <MaxCpuCount>0</MaxCpuCount>  </RunConfiguration></RunSettings>    

For the value of MaxCpuCount  use the number of threads you want to use (usually 1 for sequential run), or instead ‘0’ or a number greater of the number of your machine logical core (please use ‘0’).

Look under Test menu for “Select Test Settings File” and choose the newly minted (test settings) file.

image







For more information of what the test settings file can do for you — read this MSDN page.

Now when running the tests you’ll see improvement it the time it takes for them to finish.

mstest_parallelUntitled

















I did notice that it took longer for the tests to start running and there’s a barely noticeable delay at the end of the run but other than that — parallel tests!

As you can see the runner runs assemblies in parallel so if you have a lot of tests in one assembly — you might not benefit from this feature, please consider splitting your tests (and probably production code as well).

I still need to check if (and which) mocking frameworks would work with this new(ish) test execution.

Happy coding…

Accelerate the delivery of high-quality software in the connected IoT era through an integrated analysis, testing, security, and analytics platform

Topics:
visual studio 2015 ,unit test ,parallel ,.net ,development

Published at DZone with permission of Dror Helper, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}