question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add parameter to ensure tests run in sequence regardless of when build completes

See original GitHub issue

As initially reported in https://github.com/Microsoft/vstest/issues/1966, there isn’t currently a way to prevent dotnet test from running separate test assemblies in parallel when this is not desirable behaviour.

@ShreyasRmsft suggested that adding a new parameter to the cli that would ensure tests run in sequence regardless of when build completes would enable this.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
mikehardercommented, Dec 10, 2019

Setting the MSBuild property BuildInParallel=false seems to work for dirs.proj (using Microsoft.Build.Traversal), though it doesn’t seem to work for *.sln files. Given the following dirs.proj:

<Project Sdk="Microsoft.Build.Traversal/2.0.24">
  <ItemGroup>
    <ProjectReference Include="**\*.*proj" />
  </ItemGroup>
</Project>

If you run dotnet test -p:BuildInParallel=false dirs.proj, each test project will be run in sequence. However, dotnet test -p:BuildInParallel=false foo.sln still executes test projects in parallel.

6reactions
baronfelcommented, Dec 18, 2021

The documentation for the -m option can be found on the MSBuild command-line reference. It controls the number of concurrent processes used to execute the build, so -m:1 would limit the build to one process.

More broadly, the dotnet build/test/restore/publish commands flow through many of these MSBuild parameters to the underlying invocation of MSBuild, which is why this works. There’s more documentation about this here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlling execution order of unit tests in Visual Studio
In Solution Explorer, right click on the unit test project, click Add>OrderedTest. Doing this adds a new file to the project. When you...
Read more >
Run unit tests with Test Explorer - Visual Studio (Windows)
Learn how to run tests with Test Explorer in Visual Studio. This topic covers how to enable automatic test runs after build, view...
Read more >
How To Set Test Case Priority In TestNG With Selenium
When you have multiple test cases and want them to run in a particular order, you can use the Priority attribute to set...
Read more >
Run/Debug configuration: JUnit - IntelliJ IDEA
JUnit run/debug configurations define how unit tests that are based on the JUnit testing framework should be run.
Read more >
unittest — Unit testing framework
It checks for a specific response to a particular set of inputs. unittest provides a base class, TestCase , which may be used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found