3

Folllowing is my coverage statistics:

Coverage: 76% 310 statements 253 run 94 branches 57 missing 13 excluded 27 partial

Can anyone please help with the formula to calculate this %?

2
  • Yes Branches 94 Commented May 12, 2017 at 3:57
  • The answer is only approximate. Tell me more about why you want to calculate the number, maybe there's another way I can help. Commented May 12, 2017 at 10:22

1 Answer 1

3

You can't get the exact total from those displayed numbers, because of how branches are counted. But roughly, the total is:

total = (executions)/(possible executions)

The number of executions is the number of statements plus the number of branches, minus the number of excluded statements.

possible executions = statements + branches - excluded

The number of executions is the number of run statements plus the number of taken branches. We don't display the number of taken branches, so you have to estimate:

executions = (run statements) + (total branches - partial branches)

That gives us:

total = (253+94-27)/(310+94-13) = 81.8%
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.