Coverlet: Incorrect coverage reporting 🐛

Created on 22 Mar 2018  ·  11Comments  ·  Source: coverlet-coverage/coverlet

The coverage report for 87135a5d0c3c5a27db83509fba01774dd20201d9 claims that DictionaryExtensions.cs has 75% coverage. It only has one method:

https://github.com/tonerdo/coverlet/blob/87135a5d0c3c5a27db83509fba01774dd20201d9/src/coverlet.core/Extensions/DictionaryExtensions.cs#L7-L14

According to the report, lines 9, 10 and 13 are covered but not line 12 (thus the 75%). How can 13 be covered but not 12? Is this a bug or am I misreading something? The only test for this method…

https://github.com/tonerdo/coverlet/blob/87135a5d0c3c5a27db83509fba01774dd20201d9/test/coverlet.core.tests/Extensions/DictionaryExtensionsTests.cs#L10-L17

…seems to cover it 100%.

Most helpful comment

@atifaziz I have noticed this little kinks here and there. Currently trying to find the root cause, intend to have it fixed by this weekend

All 11 comments

@atifaziz I have noticed this little kinks here and there. Currently trying to find the root cause, intend to have it fixed by this weekend

we saw similar issues here. some lines between covered ones where missing where it wasn't possible to branch.

@OneCyrus @atifaziz This issue has been fixed in #10 and you'll see that the coverage for this repo increased as a result.

It was actually a pretty straightforward fix and a good side effect is it sets the foundation for branch coverage support. This fix will be in a new NuGet package I'll release this weekend, in the future I'll setup a nightly CI package publish so improvements can get out faster.

Cheers

@tonerdo Thanks and looking forward to trying out the new package soon after it's up.

@atifaziz New NuGet package release: https://www.nuget.org/packages/coverlet.msbuild/1.0.1

@OneCyrus lemme know if the new NuGet package also fixes the issues you were seeing regarding coverage accuracy

it improved here but there are still some missing parts. e.g.:

image

Thanks for pointing that out. Any other examples you can show? A larger sample size is always helpful

here's another example:

image

it looks like it doesn't like LINQ. all the missing things I saw are related to LINQ.

I'm not surprised, the IL the compiler generates for LINQ is horrendous. I'll take a closer look, thanks

@OneCyrus kindly use the latest NuGet bits which has branch coverage support and see if this helps fix this issue. Thanks

Was this page helpful?
0 / 5 - 0 ratings