1 Installing the Tool
2 Using the Tool
3 Covered Files Dialog
3.1 Line Coverage Percent
3.2 Invalid Coverage Information
4 Uncovered Lines Dialog
5 Common Questions
5.1 Saving Coverage Information
5.2 My source file doesn’t show up in the covered files dialog

Multi-File Code Coverage Tool

The Multi-File Code Coverage Tool allows coverage information gathered from a single program evaluation to be displayed on multiple source files in multiple DrRacket windows.

1 Installing the Tool

Multi-File Code Coverage is a Planet package, however it only adds a tool rather than providing functions. To install evaluate the following program:

#lang racket
(require (planet jowalsh/code-coverage))

... and then restart DrRacket. The "Multi-File Coverage" button should now be visible as seen below.

2 Using the Tool

First ensure that you have "Syntactic Test Suite Coverage" enabled in the "Language->Choose Language..." dialog. You may need to click the "Show Details" button to see the expanded options. Then run the program you wish to collect multi-file coverage information for. Finally, click the "Multi-File Coverage" button. This will send the coverage information to other open files and apply code coverage highlighting to them. The Covered Files Dialog will also appear containing the list of files covered by the program you just ran.

You may then select one, or more, of the covered files to open and switch focus to. Additionally, by clicking the "Open With Uncovered Lines Dialog", instead of just "Open", each selected file will spawn the Uncovered Lines Dialog with a list of lines containing unevaluated expressions.

3 Covered Files Dialog

The Covered Files Dialog appears after clicking the "Multi-File Coverage" button. It displays a list of files covered by the currently in-focus program and allows the selection of a file to open and switch focus to.


Covered Files Dialog

3.1 Line Coverage Percent

The percent in parentheses, next to each file in the Covered Files Dialog, is the percent of covered lines in that file. So 100% indicates that every line in that file is covered. Blank lines and comments are also counted as covered lines.

3.2 Invalid Coverage Information

An asterisk may appear next to a file in the Covered Files Dialog. This indicates that the file has been modified since multi-file coverage information was last collected, which may have invalidated its coverage info. To ensure that all coverage information is valid run the program you are collecting multi-file code coverage for again.

4 Uncovered Lines Dialog

The Uncovered Lines Dialog contains a list of line numbers, for an individual file, that are not fully covered.


Uncovered Lines Dialog

5 Common Questions

5.1 Saving Coverage Information

Whenever the "Multi-File Coverage" button is clicked the multi-file code coverage information is saved to a file. This file is named <file name>.rktcov and saved in the "compiled" directory next to the source file.

5.2 My source file doesn’t show up in the covered files dialog

Only un-compiled files will appear in the Covered Files Dialog. To ensure that all your covered files appear delete any "compiled" directories next to your source files. Then run your program again and click the "Multi-File Coverage" button.