I have set gcov code coverage tools on Jenkins.
This works fine, but I have troubles undertanding the ouput color code. The number of 'hits' of each line is corect, but some line are green when others are red, and I can't tell why.
Example :
Note that the setYear method is all green, and called 13 times (ctor + 12 times in setDateAAMMJJ as you can see on the screen cap)
Don't know if this applies for you but it seems relevant. In my case it is red because branch cover is not 100%. When generating an xml with gcovr it also adds branch cover data.
It is possible to cover all the lines but not cover all the branches. Im having all kinds of problems with the branch cover.
Some are described in these posts.
Why gcc 4.1 + gcov reports 100% branch coverage and newer (4.4, 4.6, 4.8) reports 50% for "p = new class;" line?
What is the branch in the destructor reported by gcov?
Still looking for a way to solve issues like these..
If you look at the source code for the cobertura-plugin
on github you will see that:
table.source tr.coverPart td.hits, table.source tr.coverNone td.hits {
background-color: #fdd;
font-weight: bold;
}
and
table.source tr.coverPart {
background-color: #ffd;
}
#fdd
is the red color,#ffd
is the yellow colorYou should be able to use your browser 'developer tools' or 'inspector' function to see which class is applied.
The yellow on the far left means the source code is covered partly, that means you probably don't have 100% coverage in the functions that are being called.
Another case I can think of (pure speculation at this point) is that some optimization is mangling your statement coverage; check your compilation flags.
If you kept the data (lcov files), you should be able to use genhtml
to generate a report and compare.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With