-
Notifications
You must be signed in to change notification settings - Fork 387
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
[BUG] Empty cobertura.xml in coverlet.collector 6.0.3 that is not reproduced in 6.0.2 #1726
Comments
I am running into the same problem |
Thanks a lot for reporting and for the repro @kotsaris 🙏. I did some quick analysis and think the problem came in here #1645. To be even more precise I think this condition here was missed: I locally added it back and it seems to work. But maybe we should consider putting in a bit more work because I think the whole (btw @kotsaris in your repro it is also sufficient if you only remove the |
I'm facing the same issue with |
+1. Version 6.0.3 produces a coverage.cobertura.xml without any results. Reverting to 6.0.2 without other changes resolves the issue. |
would it make sense to add that condition back as a 6.0.4 patch? and address the filter logic in a minor bump? |
Hi guys, could you help out by providing a bit more input on how you are using the @JohnYoungers not sure about a new release just for this, I need to discuss this with the other maintainers. There will be the possibility to consume the fix in our nightly once we have merged it. |
Here's what I've got: <Exclude>[coverlet.*.tests?]*,[*]Coverlet.Core*</Exclude>
<Include>*C.D*</Include> The intention is to include assemblies such as:
and obviously exclude the corverlet assemblies. I honestly don't recall why the exclude looks the way it does other than to say that it took longer than I expected and I couldn't spend any more time on it. Without the exclude, coverlet assemblies were throwing off the code coverage percentage. |
And we're doing something like this: dotnet test
--configuration Release
--no-build
--no-restore
--logger:trx
--verbosity minimal
--filter RunOnBuildServer!=false&Category=Unit
--results-directory test-outputs/component
/p:CollectCoverage=true
/p:ExcludeByAttribute="GeneratedCodeAttribute,ExcludeFromUnitTestCoverageAttribute"
/p:Exclude=[*]*.Migrations.*
/p:CoverletOutputFormat=opencover
/p:CoverletOutput=coverage.opencover.Unit.xml
Tests/Tests.csproj |
I understand the hesitation, but I think as time goes on, this will catch more and more consumers with automated nuget update processes for patch releases. This would be a sample of our usage:
|
We run our test builds from a bash script. Our problem is not specifically Here's the GitHub actions output where we no longer receive results. Broken coverage$ dotnet test --no-restore --no-build -c Release \
/home/runner/work/my-product/my-product/my-service/test/Abc.MyService.Tests/Abc.MyService.Tests.csproj \
--results-directory /home/runner/work/my-product/my-product/my-service/test/TestResults/output/ \
--logger trx;LogFileName=Abc.MyService.Tests.trx \
--logger html;LogFileName=Abc.MyService.Tests.html \
-p:CollectCoverage=true \
-p:Include=[Abc.MyService*]* \
-p:Exclude="[*.Tests]*,[Abc.*]*.Migrations.*,[Abc.*]*.SourceGenerationContext" \
-p:CoverletOutput=/home/runner/work/my-product/my-product/my-service/test/TestResults/output/ \
-p:CoverletOutputFormat="json,opencover,cobertura,lcov"
[coverlet] _mapping file name: 'CoverletSourceRootsMapping_Abc.MyService.Tests'
Test run for /home/runner/work/my-product/my-product/my-service/test/Abc.MyService.Tests/bin/Release/net9.0/Abc.MyService.Tests.dll (.NETCoreApp,Version=v9.0)
VSTest version 17.12.0 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /home/runner/work/my-product/my-product/my-service/test/TestResults/output/Abc.MyService.Tests.trx
Html test results file : /home/runner/work/my-product/my-product/my-service/test/TestResults/output/Abc.MyService.Tests.html
Passed! - Failed: 0, Passed: 687, Skipped: 0, Total: 687, Duration: 1 m 20 s - Abc.MyService.Tests.dll (net9.0)
[coverlet]
Calculating coverage result...
Generating report '/home/runner/work/my-product/my-product/my-service/test/TestResults/output/coverage.json'
Generating report '/home/runner/work/my-product/my-product/my-service/test/TestResults/output/coverage.opencover.xml'
Generating report '/home/runner/work/my-product/my-product/my-service/test/TestResults/output/coverage.cobertura.xml'
Generating report '/home/runner/work/my-product/my-product/my-service/test/TestResults/output/coverage.info'
+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+
+---------+------+--------+--------+
| | Line | Branch | Method |
+---------+------+--------+--------+
| Total | 0% | 0% | 0% |
+---------+------+--------+--------+
| Average | 0% | 0% | 0% |
+---------+------+--------+--------+ Though we have another service where we still receive the output. Still working coverage$ dotnet test --no-restore --no-build -c Release \
/home/runner/work/my-product/my-product/other-service/test/Abc.OtherService.Tests/Abc.OtherService.Tests.csproj \
--results-directory /home/runner/work/my-product/my-product/other-service/test/TestResults/output/ \
--logger trx;LogFileName=Abc.OtherService.Tests.trx \
--logger html;LogFileName=Abc.OtherService.Tests.html \
-p:CollectCoverage=true \
-p:Include=[Abc.*]* \
-p:Exclude="[*.Tests]*,[Abc.Testing.*]*,[Abc.Platform.Testing.*]*" \
-p:CoverletOutput=/home/runner/work/my-product/my-product/other-service/test/TestResults/output/Abc.OtherService.Tests.coverage.json
[coverlet] _mapping file name: 'CoverletSourceRootsMapping_Abc.OtherService.Tests'
Test run for /home/runner/work/my-product/my-product/other-service/test/Abc.OtherService.Tests/bin/Release/net9.0/Abc.OtherService.Tests.dll (.NETCoreApp,Version=v9.0)
VSTest version 17.12.0 (x64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: /home/runner/work/my-product/my-product/other-service/test/TestResults/output/Abc.OtherService.Tests.trx
Html test results file : /home/runner/work/my-product/my-product/other-service/test/TestResults/output/Abc.OtherService.Tests.html
Passed! - Failed: 0, Passed: 776, Skipped: 0, Total: 776, Duration: 50 s - Abc.OtherService.Tests.dll (net9.0)
[coverlet]
Calculating coverage result...
Generating report '/home/runner/work/my-product/my-product/other-service/test/TestResults/output/Abc.OtherService.Tests.coverage.json'
+-----------------------+--------+--------+--------+
| Module | Line | Branch | Method |
+-----------------------+--------+--------+--------+
| Abc.OtherService | 100% | 100% | 100% |
+-----------------------+--------+--------+--------+
| Abc.OtherService.Apps | 99.32% | 94.58% | 100% |
+-----------------------+--------+--------+--------+
+---------+--------+--------+--------+
| | Line | Branch | Method |
+---------+--------+--------+--------+
| Total | 99.36% | 94.76% | 100% |
+---------+--------+--------+--------+
| Average | 99.66% | 97.29% | 100% |
+---------+--------+--------+--------+ |
I am running into the same problem |
I'll echo this. I don't know how many people are likely to be affected but the impact is significant (it doesn't work at all) so I would probably pull it before too many people upgrade after the holidays. |
Thanks a lot guys 🙏 . I understand it much better now and think my changes should work. Could somebody try out the version I compiled locally? |
Sorry for the delay; I meant to follow-up on Friday: I attempted to test the new version, but noticed it was returning coverage results locally on 6.0.3 (on windows opposed to linux), so I couldn't compare with the new version |
I meant to report this issue months ago and forgot =(. Per my notes it was introduced with You asked what our Include/Excludes look like....
It's been a while, but I believe:
Another project has (very similar):
|
|
@daveMueller Yes, these updated packages solve the problem for us. |
@daveMueller: you closed the issue, but it would be great if you could provide some more information about the next steps 🙂 currently we're using coverlet Or am I misunderstanding something and you're already in the midst of providing a fix |
@mu88 Sorry for the misunderstanding. The issue was automatically closed when I merged the PR. We planned some breaking changes for the ps: The nightly build is also called something with |
@daveMueller I have tested the latest nightly build package version 8.0.0-preview.2.ge3717da4a7 and it is working as expected against my exclusion rules. |
@daveMueller: I don't find any |
use 8.0.0-preview.2.ge3717da4a7 |
Sorry |
yes, it is working again with |
Good news, we now officially released the fix with version |
Nice work @daveMueller. @dependabot updated all our projects last night, and I can confirm the fix has resolved our issue. |
Describe the bug
I recently upgraded to 6.0.3 and I noticed the pipelines failing. It seems that cobertura.xml comes out empty. I am using a runsettings file with exclude/include. I notice that if I remove these sections the cobertura gets populated.
That said, coverage works fine and cobertura gets entries on 6.0.2 of coverlet.collector nuget package.
To Reproduce
Check out https://github.com/kotsaris/repro-coverlet-empty-cobertura cd into ClassLibrary1 folder and run tests via
Expected behavior
It should populate cobertura.xml with something.
Actual behavior
Cobertura.xml is empty.
Configuration (please complete the following information):
Run Settings:
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? 6.0.3
* Which version of .NET is the code running on? 9
* What OS and version, and what distro if applicable? Windows 11
* What is the architecture (x64, x86, ARM, ARM64)? x64
* Do you know whether it is specific to that configuration? 6.0.2 does not exhibit this
Additional context
Downgrade to 6.0.2 and the problem goes away.
The text was updated successfully, but these errors were encountered: