Avoid parallel Unit Test execution for all tests in a single class

3.4k views Asked by At

For performance reason I execute the Unit Test in parallel. There are several classes in which Unit Tests cannot be executed in parallel (I know that this is problematic but trying to find an intermediate solution).

Is there a way to configure to execute tests in a class sequentially while running all tests in solution?

2

There are 2 answers

0
Oscar Canek On

Use xunit and turn off the parallelism using

[assembly: CollectionBehavior(DisableTestParallelization = true)]

in the AssemblyInfo.cs file of your unit test project.

If you are using Microsoft.VisualStudio.QualityTools.UnitTestFramework checkout this link to see how easy is to migrate to xunit Comparing xUnit.net to other frameworks

0
Jocke On

It looks like the setting is on project level, so having two test projects with different setting would perhaps be a intermediate solution.

https://msdn.microsoft.com/en-us/library/ee921484(v=vs.100).aspx