-
Notifications
You must be signed in to change notification settings - Fork 481
Enable code coverage during testing #1614
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
Comments
@tmat This is my first priority this week. At this point I have a very good understanding of how the pieces fit together (portable/embedded PDB + xunit console + OpenCover console + reporting), but very little understanding of the way roslyn-tools invokes the xunit console for testing purposes. I'm hoping you can help me incorporate each of the necessary steps above into the testing harness we use. |
Why is this needed now? If anything it would be better to invest our time in helping OpenCover to support Portable PDBs. |
@tmat That could be beneficial as well. I found in the proof of concept that the PDB conversion step wasn't quite as complex as mentioned above because the built uses embedded PDB for all binaries. |
I'd love to get automatic code coverage reports. But I'm not sure if it's worth the complexity at this point. The effort spent on implementing a workaround in our repos won't help our customers. Effort spent on helping OpenCover to adopt Portable PDBs faster will help everyone. |
@tmat fortunately, of the issues involved with getting this working, the PDBs seem like a solved problem. The toolset already included everything to make it work seamlessly. We can take a look at the couple remaining small items tomorrow. 😁 |
I don't think I'll have time this week to look into this. |
I think the ticket is no longer relevant as we can see coverage on PRs (ping @sharwell ). |
Currently the test script does not run the tests with code coverage enabled. Several steps are required to enable code coverage collection:
Ensure Windows PDBs are available for OpenCover
The following sequence applies this to all assemblies in a folder (e.g. the folder containing a unit test output):
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/c7254023938e4e6cc5bb03caf6da0ba814845203/build/opencover-report.ps1#L54-L95
Wrap the unit test call with OpenCover.Console
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/c7254023938e4e6cc5bb03caf6da0ba814845203/build/opencover-report.ps1#L111-L121
Prepare the results
For local builds, run ReportGenerator on the output:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/c7254023938e4e6cc5bb03caf6da0ba814845203/build/opencover-report.ps1#L147-L148
For CI builds, send the collection to codecov.io:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/c7254023938e4e6cc5bb03caf6da0ba814845203/appveyor.yml#L14
The text was updated successfully, but these errors were encountered: