I am looking for ways to run test suites in parallel.
I am aware of .testrunconfig
setting. This allows you to multiplex on the number of CPUs.
I want to run 1000 tests in parallel. This makes sense because I am testing a web service, so 90% of the time spent in a test is waiting for the service to respond.
Any ideas on how to pull this off ? The tests are written for VS, but I am open to running them outside of VS.
Later edit: the Visual Studio test team have added this in VS 2015 Update 1. See Mark Sowul's answer bellow.
The biggest advantage of MSTest is that it allows parallelization at the method level. As opposed to the other frameworks which only allow parallelization at the class level. So, for example, If you have 100 test methods in 5 classes, MSTest will let you run 100 tests in parallel.
Parallel Testing using TestNG and Selenium Methods: Helps run methods in separate threads. Tests: Help to run all methods belonging to the same tag in the same thread. Classes: Helps to run all methods belonging to a class in a single thread. Instances: Helps run all methods in the same instance in the same thread.
Unit tests run one at a time. There is no parallelism.
To run MSTest unit tests, specify the full path to the MSTest executable (mstest.exe) in the Unit Testing Options dialog. To call this dialog directly from the editor, right-click somewhere in the editor and then click Options.
Most of the answers on this page forget to mention that MSTest parallelizes tests in separate assemblies. You have to split your unittests into multiple .dll's to paralelize it.
But! The recent version - MSTest V2 - now CAN parallelize "in-assembly" (yay!) you just need to install a couple of nuget packages in your test project - TestFramework and TestAdapter - like described here https://blogs.msdn.microsoft.com/devops/2018/01/30/mstest-v2-in-assembly-parallel-test-execution/
And then simply add this to your test project
[assembly: Parallelize(Workers = 4, Scope = ExecutionScope.ClassLevel)]
EDIT: You can also disable parallel execution for a specific test using [DoNotParallelize]
on a test method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With