-
Notifications
You must be signed in to change notification settings - Fork 7
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
Coverage dropped when Coverage didn't change #1746
Comments
My guess (as a general dev who fights coverage on and off) is that as you've changed the numerator and denominator, the percentages will be slightly different. Imagine you had 4 lines of code and 3 were tested (3/4). If you add one tested line of code, you would then have (4/5) which would show up as a significant change. If instead you have 990 lines of tested code out of 999 lines and add 1 line of tested code, you move from 990/999 to 991/1000 which is a change (0.000009009009009...) even if it's approximately zero (≈0). Remember that coverage is reported as a percentage, it isn't a count of uncovered lines, so when you add a covered line you're mostly seeing the effects of changing the denominator. |
@jcubic @jsoref tI will start by adding a Summary: Details: As an example, let's take your first cited build, which showed a coverage drop of (Please ignore the collapsible window of Admin data from my view.) In terms of changes in coverage, each build is compared with its "preceding build," or "previous build," which, in the case of In the case of this build: It's a Which you can get to by clicking the "Prev Build" link in the inner left nav of your Build Page: So let's compare the changes in coverage, by comparing changes in stats between the Previous Build (Build #7560115104) (LEFT), and the Current Build (Build #7571839635) (RIGHT): The first issue I see there is the ( You have this repo setting ENABLED: So branch coverage should be included in your aggregate coverage calculation, and ( (So that is probably a bug and I have asked someone to look into it. However, unfortunately, due to the age of the build, we no longer have the original coverage report stored, so we don't have that to examine. That said, if those are the stats we got, that part of the aggregate coverage % calculation is clearly inaccurate.) Now would be a good time to share the formula for aggregate coverage %, which is:
Or, without branch coverage included:
In your case, just the branch coverage portions of those two calculation should have been: Build #7560115104 (LEFT): And: Build #7571839635 (RIGHT): Which, using the formula would have resulted in your aggregate coverage calculations being: Build #7560115104 (LEFT):
Which is what we got, so I suspect the ( And: Build #7571839635 (RIGHT):
Which is also what we got for that build, so, again, I suspect the ( But if you don't mind, let's leave that aside for now. Before I finish this I will try re-processing each build to see if that issue might resolve itself. Regardless, though, I believe the aggregate coverage % calculations are accurate per the stats we received. The next place to look to understand where those stats came from is the CHANGED TABS in your SOURCE FILES table(s). Since we're trying to understand the changes between those two builds, let's look at the CHANGED TABS for the Current Build (Build #7571839635 (RIGHT)): According to the CHANGED tab, only one file changed, and, in terms of coverage changes, the relevant changes are the LINE MISSES and BRANCH MISSES there (7 new misses). These changes are easier to understand in a side-by-side context as well, so after searching that file name in the SOURCE FILES table in your previous build, here's that: I hope that's helpful as a general approach to investigating coverage changes. Please use it as a guide and let me know if you have any open questions that remain for your other builds. We can even start with the one I used here in case anything looks off to you. Also, if you'd like to choose some more example builds, more recent builds are better in terms of us still having their original coverage reports on hand. |
I still don't understand how, by adding one branch that is covered by test, I have +3 missed and +4 branch missed. I understand the calculation part, but it looks like the information about the changes is wrong. If you want, I can try to create a copy of my project with the above change as the last one, so you will be able to see the coverage data. |
Hi @jcubic. I understand: You only added three (3) lines to the project. Two (2) of those lines---representing a new branch---were uncovered by tests, so you wrote a test to cover those two lines (by covering the new branch). Therefore, why +3 missed lines, and +4 missed branches? AnswersI was also curious, so I performed some analysis and what I can say by way of response is:
And:
If those coverage stats change in unexpected ways (beyond the scope of your changes and the changes in coverage you expect), for whatever reason, then your test suite can be said to be non-deterministic. I'm not saying yours is, just that, based on these results, it might warrant further investigation. Coveralls makes no judgements about or changes to the coverage reports it receives from users. File-by-file, or build-by-build, it just consumes the stats in the reports and then performs aggregate coverage calculations on them. In the case of this one (quite large) file, The results are as follows: MethodsBefore the results, though, my methods:
ResultsComparison of coverage reports for
|
P.S. @jcubic. Another possibility is that some tests were missing from the test suite on one or the other commit. Unfortunately, GitHub doesn't have those Actions logs anymore either. I checked for any original coverages reports we had stored and unfortunately we don't have any. (Your last build was from Apr 2. I think we store them for 90-days.) One option is to simply re-run one of your more recent builds. That should re-send the coverage report and generate a new build. If you get a message that the "build is closed", you can simply delete the existing build at Coveralls (see screenshot for Delete link), and re-run from CI. That should ensure an entirely new build. |
In this commit:
LIPS-scheme/lips@28a58e6
I've added this code:
The code was tested and it's covered by tests, because I checked the JSON file generated by C8 and the lines are green. But Coveralls said that Coverage dropped by -0.02%
https://coveralls.io/builds/65153629
In the same, I deleted one line of code and Coveralls said that the Coverage dropped by 0.002%
https://coveralls.io/builds/65177310
Another example I've updated dependencies and Coverage dropped by 0.3%
https://coveralls.io/builds/65163814
It looks like reports are Random. Can you explain the dropping of Coverage?
This is my coverage status:
Not sure why I have
85.669%
.EDIT: Another issue is reverse, the code was added that was fully Tested and Coveralls says that the Coverage increased by 0.02% but nothing changed:
https://coveralls.io/builds/65485219
The text was updated successfully, but these errors were encountered: