|
The Coverage and Hotspot Analyzer is a tool for analyzing code
coverage and hotspots in Perl programs and test suites. It can be used
to test different versions or revisions of a program and compare them
visually, or compare different test runs on the same code.
Each test run is referred to as an Experiment. Projects are logical
groups of similar Experiments.
Experiments can be a simple command, the execution of a module's
built-in test suite (e.g. `make test` on a CPAN module), or more complex
testing scripts.
Experiments can be repeated using the same commands on new revisions of
the code base, or repeated with some variation on the command or test
script on the same code base. The results of these tests (runtime, code
coverage, hotspots and other execution information) are stored in a
database and can be easily viewed and compared.
The commands that produce experiment data are executed using
perlcov-perl, a replacement perl interpreter which
gathers the coverage and hotspot data and stores it in the Analyzer's
database.
- Finding unexercised code
-
If you have a large program that uses several modules, you probably want
to know if your test suite is actually running all the code. Running the
test suite from within the Analyzer (e.g. `make test`) will show which
parts of the code have not been run and which files have the least or
most coverage.
- Checking for changes in coverage
-
Using the Experiment model, it is easy to repeat the the same test
suite on revised code to see changes in coverage. The coverage histogram
gives an overview of the coverage for each experiment, and the
Compare
Coverage feature, lets you compare two experiments file by file and
function by function.
-
Similarly, instead of changing the codebase, you could change the test
suite and compare the coverage.
- Finding hotspots
-
Hotspots are areas of code which are run more often than others, or
that take longer to run than average. Using the View Hotspots and
Compare Hotspots features it's easy to see and compare these.
Hotspots can be viewed as Experiment Normalized, showing the
percentage of the total experiment time used by a given line, or
Function Normalized, showing the percentage of the subroutine
execution time used by a given line.
|