azure-devopsazure-pipelinesvstestazure-devops-server-2020vstest.console

VSTest Task Parallelization for each test assembly


I have the scenario where I have multiple test assemblies: TestAssembly1.dll, TestAssembly2.dll, TestAssembly3.dll, ... Each of these assemblies contains multiple tests but within one assembly tests must be executed sequentially due to an external dependency which is unique for each assembly.

Is it possible to run each of these assemblies in parallel on an assembly level on DevOps Server 2020 with the VSTest Task?. This task uses the vstest.console.exe and it has the option to enable parallelism but as far as I understand this executes every test in parallel and not in an assembly level.

For writing the tests we use NUnit 3.


Solution

  • VSTest Task Parallelization for each test assembly

    You could try to activate the parallel feature at an assembly level in NUnit is by adding following line in the AssemblyInfo.cs file:

    [assembly: Parallelizable(ParallelScope.Fixtures)]
    

    The above line of code will make all fixture classes to run in parallel.

    Please refer this document Specifying Parallelism at Multiple Test Levels for some more details.