Information Technology Reference
In-Depth Information
FIGURE 7-5 Report showing the code duplication report generated by Simian and Ant
has 100 lines and 65 of them were touched, then the class has a line
coverage of 65%. Likewise, if a code base comprises 10,000 noncom-
menting lines of code and 3,000 of them were exercised on a particular
test run, then the code base's line coverage is 30%.
Some tools also offer reporting for branch coverage (sometimes
referred to as path coverage). These tools attempt to measure the cov-
erage of decision points, such as conditional blocks like if and else .
As with line coverage reporting, if there are two branches in a particu-
lar method and both were covered through tests, then you could say the
method has 100% branch coverage.
For example, in Maven environments, running EMMA requires
two steps. First, you download the plug-in and place it into Maven's
plug-ins directory. Second, you run the emma goal, which automatically
compiles both the source code and the test code. EMMA then instruments
the source code and runs the test code directly via the test:test goal.
EMMA generates an HTML report like the one shown in Figure 7-6.
Search WWH ::




Custom Search