trident-job / delphi-code-coverage

Automatically exported from code.google.com/p/delphi-code-coverage
0 stars 0 forks source link

Code coverage statistics do not include dead code #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Perhaps I don't understand how I am supposed to use this tool, but I am not 
getting useful statistics (the line by line coverage reporting is GREAT though)

What steps will reproduce the problem?
1. Run the code coverage tool against a unit that has hardly any unit tests. 

What is the expected output? What do you see instead?
I expect to see a very low coverage percentage.

Instead, I get a high percentage.

I'll give you a real example.

We have a Unit with 1430 lines. We have very few unit tests that exercise the 
code in this Unit.

The statistics I get back are

Number of lines covered     173
Number of lines with code gen   270
Line coverage in percent    64%

We are only covering a little more than 10% of the lines in this file. If you 
disregard headers, blank space etc I would still say we only have 20% coverage. 

The tool is only counting lines that "have code gen". I don't see the point of 
this: if a function is not covered by unit tests, it will be dead code, and 
won't appear in the .map file. Isn't this what we should be looking for, and 
adding to our unit tests?? Not just generated code paths that are not called?

This has been my experience of other code coverage tools in other languages.

What version of the product are you using? On what operating system?
0.5

Original issue reported on code.google.com by awmr...@gmail.com on 7 Mar 2011 at 6:40

GoogleCodeExporter commented 9 years ago
Delphi-Code-Coverage only covers code that the compiler puts in to the 
executable. It does not (and most likely will never) cover dead code that the 
compiler strips out. For that, you would need something like AQTime.

Original comment by ring....@gmail.com on 20 Oct 2011 at 12:34