question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Branch coverage is not showing the correct number

See original GitHub issue

I have two different situations in which I believe the reported coverage is incorrect. Please let me know if this is the expected behaviour and if/how I could get these branches covered.

Situation 1:

image

<method name="GetPendingInvitationsByTypeAsync" signature="()" line-rate="1" branch-rate="1" complexity="NaN">
  <lines>
    <line number="111" hits="18" branch="false" />
    <line number="112" hits="18" branch="false" />
    <line number="113" hits="18" branch="false" />
    <line number="114" hits="18" branch="false" />
    <line number="117" hits="18" branch="false" />
    <line number="121" hits="18" branch="false" />
    <line number="123" hits="18" branch="false" />
    <line number="124" hits="18" branch="false" />
  </lines>
</method>

I would have expected line 118, 119 and 120 to show coverage as well just like line 112, 113 and 114. I also expected that due to the .Where clause this would create multiple different branches.

Situation 2:

I’m using EFCore and calling AddAsync seems to have resulted in 2 different branches. image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dannyBiescommented, Apr 8, 2020

I’ve tried to create a repro at https://github.com/dannyBies/CoverletIssueRepro. Unfortunately it doesn’t seem like I can get the issue to appear and I’m not sure why.

0reactions
MarcoRossignolicommented, Apr 8, 2020

Ok np thank’s a lot for your time/help, very appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing Branch Coverage Sonar issue - java
I am trying to run sonar and i take a sample of my code a sampleClass to fix the branch coverage issue: The...
Read more >
What Is Branch Coverage and What Does It Really Tell You?
What is branch coverage? That's the question we'll answer today. You'll learn what this metric is all about and how it can help...
Read more >
What's a Branch and How to Make Sure It's Covered
Use a code coverage tool, our coverage tool lets you see the exact branch coverage, the amount of entries in each condition and...
Read more >
Code coverage on branches does not break quality gate
I am currently working with a test instance and an evaluation license. I am facing the following problem: Somehow, code coverage does not...
Read more >
IDEA shows uncovered branches but I cannot find ...
IDEA shows uncovered branches but I cannot find conditions to solve it and Sonar shows all conditions are covered.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found