Skip to content
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

Code coverage report does not match tests #20106

Closed
FireAlkazar opened this issue Feb 5, 2017 · 3 comments
Closed

Code coverage report does not match tests #20106

FireAlkazar opened this issue Feb 5, 2017 · 3 comments
Labels
area-Meta question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@FireAlkazar
Copy link
Contributor

I'm working on System.Configuration code coverage #20040 and a little bit stuck with coverage report.

Problem description
There is a test, that covers exception catch and throw in method, but both local and CI code coverage reports show, that the lines of method code are not covered.

Details
Test for System.Configuration.TypeUtil
TypeUtil line, that works for test
Code Coverage Report, navigate to System.Configuration.TypeUtil, click GetType(System.String,System.Boolean) method to see code coverage.

I've checked that this line is reached by changing exception to ArgumentException("hahaha") in method and test, but the report still shows no coverage. Test works fine.
image
image

cc @karelz @JeremyKuhne @danmosemsft @dhoehna

@stephentoub
Copy link
Member

It's showing as not covered because that code isn't covered: the System.Configuration.ConfigurationManager.Tests project is including the TypeUtil.cs file from the src into the tests project, so the code that's getting executed here is the copy in the tests project, not in the actual library:
https://github.com/dotnet/corefx/blob/master/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj#L27-L29

@FireAlkazar
Copy link
Contributor Author

@stephentoub thank you, that explains the case. So, we can't relay on report, that estimates coverage.

@stephentoub
Copy link
Member

thank you, that explains the case. So, we can't relay on report, that estimates coverage.

IMHO, we should change the test project to not include this code, and then write tests that exercise this code in the product via the public entrypoints.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Meta question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests

3 participants