-
Notifications
You must be signed in to change notification settings - Fork 325
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
Allow specifying the degree of parallelism #4044
Comments
@MatisseHack I think all the options you set are propagated correctly but our code assumes that tests will run in parallel (doing CPU bound work at the same time), and hence it chooses the minimal number between logical processor count, the specified maxCpuCount and assembly count to avoid overwhelming the CPU with too much parallel work. In your case the maxParallelLevel will be 2, because you have 2 logical processors. In your case this assumption is not correct, because your tests are IO bound, and hence they run concurrently on the processors (they don't always do CPU work, so more than 2 concurrent tests can easily be handled by the CPU). We don't have an option for that, and I don't think we can easily add it as there is an existing behavior, and we don't want to add yet another very similar option. |
Do you mean that
Allowing this parameter and making it consistent with the behavior of Is there any way to use the same test adapter for all assemblies then? I'm not familiar with the internals of VSTest, but am I correct in thinking that it's creating a separate xUnit test adapter for each assembly, which overrides xUnit's ability to run assemblies in parallel? Would it be possible to add an option to adjust this behavior instead? |
I don't understand that having test frameworks, like xUnit, that are able to handle (and interested in doing that) parallelism, vstest opts for the no-no, "I don't support it, nor I let others do it". Woudn't be the easiest for vstest to hand over that responsibility to the test framework or, at least, allowing that option? |
This is a new feature and won't be implemented, we are focusing on adding new features to Testing.Platform instead. https://aka.ms/testingplatform |
Description
I have several test projects written with xUnit that I want to run in CI. These unit tests are IO bound and run much more quickly when parallelized with
dotnet vstest --parallel
. However, machines in my CI system (GitHub Actions) only have two CPU cores, which limits test execution to two concurrent assemblies. I would like to speed up my tests when run in CI by increasing the degree of parallelism further.I added the following
xunit.runner.json
file to my project, but it only affected parallelization within each assembly.I was very surprised that
parallelizeAssembly
seemingly has no effect when run with thedotnet
CLI. I assume MSBuild and VSTest create separate xUnit test runners for each assembly, which is why this setting has no effect?I was able to work around that issue by using
dotnet test --no-build -maxCpuCount:8
, but themaxCpuCount
parameter does not work withdotnet vstest
, which tends to give me cleaner test output. Would it make sense to add support formaxCpuCount
(or a similar parameter) in VSTest?Steps to reproduce
Run
dotnet vstest --parallel
on a machine with more test projects than CPU cores.Expected behavior
The
dotnet
CLI should respect properties in myxunit.runner.json
file. However, barring that, it would be nice if there was a parameter that would increase the degree of parallelism when runningdotnet vstest --parallel
.Actual behavior
A higher degree of parallelism can only be achieved when running tests through MSBuild (
dotnet test
).Diagnostic logs
N/A
Environment
Linux and macOS
The text was updated successfully, but these errors were encountered: