Reputation: 53
How to execute specflow test case parallel on the same test agent using MS test
Upvotes: 1
Views: 1489
Reputation: 5634
You have two options:
Assembly Attribute
This option is suitable if you have only one test assembly and code is modifiable.
If you can add below assembly attribute anywhere in your assembly (e.g. properties.cs file or any test class file), you should be able to get the specflow tests running paralely.
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
.runsettings file settings
If you have multiple test assemblies you want to parellize you can create a file named .runsettings at the root of the solution:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<MSTest>
<Parallelize>
<Workers>8</Workers>
<Scope>MethodLevel</Scope>
</Parallelize>
</MSTest>
</RunSettings>
There are 3 scopes of parallelization:
(1) ClassLevel – each thread executes a TestClass worth of tests. Within the TestClass, the test methods execute serially. This is the default – tests within a class might have interdependency, and we don’t want to be too aggressive.
(2) MethodLevel – each thread executes a TestMethod.
(3) Custom – the user can provide a plugin implementing the required execution semantics. This is presently not yet supported but mentioned because – like all of MSTest V2 – we have designed the feature with extensiblity in mind.
Refer this blog for more details
Upvotes: 1