Open rcollette opened 8 months ago
Unable to repro with this project: https://gitlab.com/codito/sample-junit-test
> dotnet test --settings test.runsettings --collect "Code Coverage;Format=cobertura" --logger:"junit;LogFileName={assembly}.test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --results-directory ./TestResults
Determining projects to restore...
All projects are up-to-date for restore.
TestProject -> /home/arun/src/spekt/sample-junit-test/TestProject/bin/Debug/net8.0/TestProject.dll
TestProject.Tests -> /home/arun/src/spekt/sample-junit-test/TestProject.Tests/bin/Debug/net8.0/TestProject.Tests.dll
Test run for /home/arun/src/spekt/sample-junit-test/TestProject.Tests/bin/Debug/net8.0/TestProject.Tests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /home/arun/src/spekt/sample-junit-test/TestResults/TestProject.Tests.test-result.xml
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 25 ms - TestProject.Tests.dll (net8.0)
Attachments:
/home/arun/src/spekt/sample-junit-test/TestResults/a780d188-d1c1-4b3d-96f4-09caf294e86d/637bc222-49b5-49d8-92c0-2acba997a6e4.cobertura.xml
I had the same issue and after a while i just realized that I referenced the wrong package.
<PackageReference Include="JUnitTestLogger" Version="1.1.0" />
This package https://www.nuget.org/packages/JUnitTestLogger did not support token/macro expansion ( https://github.com/syncromatics/JUnitTestLogger/issues/2 )
But with the correct one (from this repo) it is working :
<PackageReference Include="JunitXml.TestLogger" Version="4.1.0" />
@rcollette I hope the share of my fault can help you
I'm running tests on an entire solution, as documented here: https://devblogs.microsoft.com/dotnet/whats-new-in-our-code-coverage-tooling/
My command line looks like:
I have also tried
My CodeCoverage.runsettings file looks like:
I just get a single unit test output file