Skip to content
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

how to infer stmts,miss coulms? #76

Open
p00j4 opened this issue Sep 16, 2016 · 6 comments
Open

how to infer stmts,miss coulms? #76

p00j4 opened this issue Sep 16, 2016 · 6 comments

Comments

@p00j4
Copy link

p00j4 commented Sep 16, 2016

man @aconrad love you for this awesome work. it saved a lot of my time.
though I'm finding it strange at numbers to understand (1st 3 columns)
Am I missing something or is it a bug ?
Context
Observe, the "Missing" column gives perfect line numbers but the "stmts" & "miss" are hard to make information. Ex. 2nd row, it looks like total 7 lines are added, and 1 line is got covered but if you see "Misses" column, 2 lines are not covered yet

    +7  -1       +0.42% -656, -658, -659, -660, -661, +662, -663, -664, -665, -1232, -1233, -1234, +1236, -1338, -1339

screen shot 2016-09-16 at 4 52 44 pm

See down almost rows have this behavior.
It gives perfectly if the complete file is uncovered or not touched between builds.

here is one sample I have created to understand it better, but this is also confusing ex. 2nd row shows +60% increment which is wrong because have added 2 functions (printll & printll2) without test covered so should be showing decreased

screen shot 2016-09-16 at 6 36 52 pm

@p00j4
Copy link
Author

p00j4 commented Sep 16, 2016

and the total % (more than 100) also looks strange
screen shot 2016-09-16 at 7 28 56 pm

@aconrad
Copy link
Owner

aconrad commented Sep 17, 2016

It's hard for me to tell without a working test case.

But I am confused about what you are confused about. ;) First you say:

2nd row shows +60% increment which is wrong because have added 2 functions (printll & printll2)

Just to be clear, the row that shows +60% increment is math3.py and not math1.py which contains the functions printll and printll2.

But from what I see in the report it looks like math3.py is now newly imported in your test run but didn't used to before? The lines class TT(): (line 1) and def coreUncovered_2(self): (line 6) are now covered but weren't before. And then you added (or modified) def coreUncovered_3(self): (line 9) which also got covered (but not the body of the function). You have added 3 lines (7, 9, and 10) and covered 1 new line (9) and 2 old lines (1 and 6).

So overall in math3.py 5 lines were involved in coverage (which represents 100%, a ratio relative to the changes, not to the whole file), each line represents 20% (a fifth of the lines involved in coverage change) and 3 out of 5 lines are covered, which indeed represents 20% * 3 = 60%. At least this is how it's supposed to be interpreted.

And the TOTAL I believe it's also relative to the changes, so when you have +454.58% of improved coverage, this really means that the coverage of your app increased by about 4.5x than what it used to be in the previous version.

Does that make sense?

@p00j4
Copy link
Author

p00j4 commented Sep 19, 2016

yeah @aconrad
my bad :-( yes its about math3.py, somehow I missed the right words to explain the problem. But thanks to you for inferring it rightly 👍
yes this line clears my silly doubt about %

a ratio relative to the changes, not to the whole file

few more queries:

  1. why is is blank in "stmts" column of math3.py when I have 3 lines addition (7, 9, 10) ?
  2. I still think showing % for class & function declaration lines, misleads as if there is at-least some % of test coverage exists for respective file which is not true. ex. 1 class with 10 functions -> 11 lines are covered automatically (the declaration lines) and leads to a good % increment & looking @ numbers only is bad in such case (which generally almost folks do)
    just like 60% increment in "math3.py" is not of any use as there is not test coverage in actual.
    I understand that not including declarative lines will be a wrong mathematics but i'm just curious to know if this misleading bothers to you also & there is any work-around you have thought of. Ex. having a flag which ignores declaration lines (even from total 100% thing so calculation is not wrong) Or showing 1 more column showing % of declarative lines only which has contributed in coverage capture or just something or something else ?
    Thanks for the patience

@aconrad
Copy link
Owner

aconrad commented Sep 28, 2016

For 1, I'm not sure why the "stmts" col is empty, it might be a bug. Wanna look into it? For 2, maybe we should show the total percentage increase for the file instead of the relative increase (which, yes, is harder to reason about). Want to look into that too? ;) If you do, please submit 2 separate pull requests!

@p00j4
Copy link
Author

p00j4 commented Oct 8, 2016

all right, i'm digging and will come up with PR

@aconrad
Copy link
Owner

aconrad commented Feb 10, 2022

why is is blank in "stmts" column of math3.py when I have 3 lines addition (7, 9, 10) ?

A recent change has been merged that might be related to what you were observing, see #132

I don't know if that bug was a root issue to the other symptoms you were seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants