-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet test seems to ignore runsettings MaxCpuCount #1966
Comments
@flcdrg vstest receives one dll at a time when you run dotnet test on an sln. When you run dotnet test on an sln, after dotnet finishes build it passes the built binary on to vstest to run the tests. This means that the build is happening in parallel and soon after the tests are starting. MaxCpuCount will have no impact on this process whatsoever. Since we only ever receive one dll. Your problem is that dotnet itself is creating these in parallel. MaxCpuCount is a vstest input and dotnet ignores this. One way to get your dlls to run in sequence is to make sure build happens in sequence. Otherwise can you open an issue in the dotnet cli repo to requesting for a flag or parameter to ensure tests run in sequence regardless of when build completes. |
And this is still the case if you run |
@ShreyasRmsft It is unfortunate , that dotnet test doesn't use the information in the runsettings file. This file can be added as a parameter for dotnet test, and for the user it would feel natural that when one turns off parallel here, it also works for dotnet itself, and not just for the underlying vstest. |
@OsirisTerje agreed. The current experience is a little unintuitive. |
@flcdrg , @OsirisTerje dotnet test currently works on a single project, i.e. even you pass a solution file to it, internally dotnet test is invoked individually for every UT project. Doing this ensures that test doesn't have to wait till build is complete, & helps in performance. Hence there is no need for it to honor However we are working on bringing in support of running Current |
Thanks @mayankbansal018 ! |
Even the fact that console loggers will be intermixed makes me want to run sequentially on CI to get sane output. Please reconsider reopening this. |
I have Visual studio 2019 Version 16.5.0 Preview 2.0 and use .net core version "3.1.100"
Under UITests project, I have following foo.runsettings xml file However, it opens 3 threads in parallel, instead of 2., which basically means it ignores MaxCpuCount configuration. I also tried dotnet.exe test command as follows which did not work either and opens 3 threads in parallel. Please guide as to what am I doing wrong here. I cannot use Nunit parameters as .net core tests cannot be run with nunit parameters because Nunit console does not work with .net core yet as mentioned at issue My UITests project has assemblyinfo.cs file with following settings which seems to control the number of parallel threads and .runsettings file settings seem to not override this.
Found the SOLUTION - https://github.com/nunit/docs/wiki/Tips-And-Tricks#NumberOfTestWorkers |
FYI: The https://xunit.net/docs/configuration-files#parallelizeAssembly (edit: pasted the wrong link) |
For anyone still looking for a solution, there is the command line option
Ref: |
This seems to have been slightly broken in the latest SDK. The -m:1 switch must come directly after |
Description
dotnet test
when run against a solution that contains multiple test projects, appears to spin up a parallel test runner for each test project.Attempting to limit to one test runner at a time via the MaxCpuCount value in a .runsettings file doesn't work.
Steps to reproduce
dotnet test --settings pathtofile.runsettings
Expected behavior
Tests assemblies are run sequentially
Actual behavior
Test assemblies are run in parallel (seen in my case where the tests are database tests and they end up fighting for access to the database)
Diagnostic logs
Environment
Windows 10 1809, vstest.console 15.0.28307.421
.NET Core SDK 2.2.200/2.2.202
The text was updated successfully, but these errors were encountered: