-
I have an issue where "dotnet test" is running assemblies in parallel. I have tried adding I have: Solution The nuget dependencies of both test csproj files are: <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="NunitXml.TestLogger" Version="2.1.41" />
</ItemGroup> When I run the tests using
I get the following logged:
It even looks like dotnet test is firing up 2 instances of the tester process (which don't respect each other's parallelization):
I have built a simple 3 project solution that reproduces the problem if it would help I can provide. Other things I have tried:
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
Hi @tznind Ps. I don't think that you can pass options to the underlying adapter, as far as I know you should use a runsettings file, but note that |
Beta Was this translation helpful? Give feedback.
-
@tznind : As @mikkelbu says: Add a runsettings file, and turn off VSTest parallelization there.
|
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for the advice. I have added your settings file and run:
I get the same parallel execution (both assemblies are tested simultaneously). It is definetly reading the runsettings file because if I change the path to something that doesn't exist it complains (as it does if the XML is invalid). It seems like this is not something that can be controlled currently through microsoft/vstest#1966 I have an interim solution which is to just call dotnet test sequentially against each project in my build script with |
Beta Was this translation helpful? Give feedback.
-
@tznind Do you have a small repo with this repro'ed you could point to (or upload) ? |
Beta Was this translation helpful? Give feedback.
-
Hey sorry for the late reply. I have uploaded the minimum repro: |
Beta Was this translation helpful? Give feedback.
-
@tznind: See a workaround I posted here: https://github.com/dotnet/cli/issues/11017#issuecomment-564311592. I verified this works in your minimum repro:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
This ticket is about multiple csproj test files running in parallel despite the all the mechanisms designed to stop this happening (like MaxCpuCount - which as you say doesn't work for multiprocess). There are basically two ways to make multi csproj dotnet test run in sequence (as opposed to parallel).
Be aware that once you have a Hopefully at some point the BuildInParallel option will work with .sln files |
Beta Was this translation helpful? Give feedback.
-
For anyone still looking for a solution, there is the command line option
Ref: |
Beta Was this translation helpful? Give feedback.
-
Thanks @smchan514 for that option! That's probably the best one can do. I'll convert this to a discussion. |
Beta Was this translation helpful? Give feedback.
For anyone still looking for a solution, there is the command line option
-m:1
which specifies the maximum number of concurrent processes to use when building.Ref: