COMP 402: Production Programming← Code Coverage Tools →
|Home — Spring 2009|||||Information|||||Resources|||||DrJava|||||SourceForge|||||Blog|
Code coverage tools record what parts of the program are executed. This is particularly useful in conjunction with unit tests, since the results of those tools show which portions of the program are exercised by the tests. For example, it can tell you that a test with an
if-then-else construct only enters the
then block, but never the
To remember what lines have been executed how many times, either the source code or the compiled class files are annotated with counters for each line of code and statements incrementing those counters. Then the tests are run as usual, with the side effect of remembering how may times a line was executed. Before the program finishes, the values of the counters are written to disk and a report is generated.
As long as you have Clover available on your system (e.g. on CSnet), you can run the unit tests and generate a code coverage report by typing:
We will try to keep updated test coverage reports on the DrJava website.
Copyright © 2008-2010 Mathias Ricken