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.

dotnet test --results-directory behavior change

See original GitHub issue

With the 3.1 SDK, the behavior of the --results-directory option for dotnet test changed when running against a solution file.

With the 2.1 SDK, the path specified for the --results-directory was resolved relative to each project directory. With the 3.1 SDK, the path is now resolved relative to the solution directory.

Resolving relative to the solution directory is causing us major headaches. We have a solution with multiple test projects. Our test projects target multiple frameworks, so when we run the tests during CI, we want to collect test results for the matrix [projects x frameworks].

With the 2.1 SDK, we specified the options --framework net461 --results-directory bin/Release/net461, and would get a path like solutionDir/projectDir/bin/Release/net461/TestResults.xml.

With the 3.1 SDK, these options result in the path solutionDir/bin/Release/net461/TestResults.xml, so the result files keep clobbering one another.

Leaving out the --results-directory isn’t really a solution either, since the tests against multiple frameworks end up clobbering one another.

Was this behavior change intentional? Is there a reasonable alternative to customizing the results path on a per-project basis?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
baronfelcommented, Apr 18, 2023

This one missed a label and so the appropriate team wasn’t tagged for follow up. Apologies, folks.

0reactions
nohwndcommented, May 4, 2023

I can confirm the change happened, but cannot find the source. I can only assume that this was to make locating a common TestResults directory easier when uploading results. This was enough years ago that rolling this back would not make sense now.

Which logger you are having trouble with? Because TRX will check if there is already a file with the same name and won’t overwrite.

Also when not overriding --results-directory, the files are still put into <project>/TestResults/.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet test command - .NET CLI
The dotnet test command builds the solution and runs a test host application for each test project in the solution. The test host...
Read more >
asp.net core - dotnet test not creating test results folder
Here is my command. dotnet test "MyProject.csproj" --no-restore --results-directory "MyProject\TestResults" --verbosity minimal. And here ...
Read more >
VS Test CLI behavior changed with 16.3.0 giving ...
After debugging we found that there is a change with the VS Test Executer CLI starting with version 16.3.0. Our previous call for...
Read more >
How to export unit test results from pipeline as an artifact
I am running the following command to write the results of the unit test to a file for external reporting. dotnet test projectname....
Read more >
NET Core and .NET Standard
dotnet test can generate an NUnit3 test result file by adding a runsettings property. The property to add is TestOutputXml. This generation is...
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