How coverage report is calculated if same code executed as twice

Team,  I am executing the same package files twice. For example my package contains 10 files. I am running sanity and basic test cases against 10 java instrumented files. If I run alone sanity I am getting 25% and run alone basic test case I am getting 25%. In a single shot I am running both sanity + basic test case. Now the code  coverage percentage will be 50% or 25%(because same code is running again). I am getting only 25% code coverage. Can you please give your input why it is giving 25%? 

 

Thanks in Advance.

2 answers

1 accepted

1 vote

Are your sanity and basic tests are not mutually exclusive? In other words do they test entirely different parts of your application classes? I'm asking because tests usually overlap each other, thus the summary coverage is usually less than sum of coverage from individual tests.

If you see no difference in coverage after running both sanity and basic tests, then there are two possibilities:

  • you ran tests incorrectly, for instance you have accidentally deleted coverage files from one of tests
  • your sanity and basic tests do not differ at all, i.e. they test exactly the same functionality.

 

When you ran sanity and basic tests together and generated an HTML report - do you see both sanity and basic test cases on the "Test results" tab? Do you see both sanity and basic test classes on the "Test code" tab?

 

1 vote

Code coverage is an metric saying that how much of your code is covered by tests. It doesn't matter how many times with how many tests you'll cover one line of you code base, it's still binary metric for that single line (covered or not). The percentage Clover is calculating is basically saying  # lines covered# lines in your instrumented code base

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published 11 hours ago in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

35 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you