Reputation: 5705
I am usimg MSTest.exe tool to run my Integration tests using a command prompt (in a powershell script).
But I see that it is running very slow and I need to run it faster. Looking at the powershell output it seems like MSTest actually runs them one by one.
Is there a way to run them all together or in parallel?
I'm running the Tests with this command:
MSTest.exe "/testcontainer:C:\myTestClass.dll" "/resultsfile:C:\TestResult.trx"
Upvotes: 1
Views: 1401
Reputation: 142
You can use testsettings for that.
Add a .testsettings file in the same folder where your test dll exists.
Your .testsettings file should look like this (note the ""parallelTestCount"" attribute on the Execution element):
<TestSettings name="SecurityWebApi" id="5f0defa1-d6a5-40a6-94ae-1522a7aeeba8" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Execution parallelTestCount="5">
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-dd`enter code here`b5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
<Browser name="Internet Explorer 7.0">
<Headers>
<Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
</Headers>
</Browser>
</WebTestRunConfiguration>
</TestTypeSpecific>
<AgentRule name="LocalMachineDefaultRole">
</AgentRule>
</Execution>
<Properties />
</TestSettings>
Then in your command you can use it like this:
MSTest.exe "/testcontainer:C:\myTestClass.dll" "/runsettings:yourfile.runsettings" "/resultsfile:C:\TestResult.trx"
Upvotes: 1