Information Technology Reference
In-Depth Information
categorical test run. For example, every time the repository changes,
the unit tests are run. Using a secondary build or in regular intervals
throughout the day, component tests are executed, and most likely
once a day (usually during the evening) system tests are run. After the
system test process is run, another series of tests can be run where cov-
erage is turned on (i.e., unit tests run, then component tests, and then
system tests). This process creates a series of reports the team can view
the following morning.
Keep in mind that the three different reports have different per-
spectives, so be aware that uncovered code in one report may show
high coverage in a different report. For example, the class Foo may
have 0% coverage in the unit test report but may show high coverage
in the system test report. Also, because the three coverage reports will
be run, you must configure the build process to not overwrite, say, the
unit coverage report that just got written with the component report
that's coming next. Remember to do a move or to write each report to a
unique location. Some tools, like Java's Cobertura, have a merge capa-
bility that lets you feed each into one master report.
In Listing 7-9, an Ant target is defined that merges the Cobertura
coverage reports from three different test runs.
LISTING 7-9
The Cobertura merge Task in Action
<target name="merge-coverage" depends="all-coverage-run">
<cobertura-merge datafile="${cobertura.all.ser}">
<fileset dir="${base.dir}">
<include name="${cobertura.comp.ser}" />
<include name="${cobertura.unit.ser}" />
<include name="${cobertura.sys.ser}" />
</fileset>
</cobertura-merge>
<mkdir dir="${cov.report.dir}"/>
<cobertura-report format="html"
datafile="${base.dir}/${cobertura.all.ser}"
destdir="${cov.report.dir}" srcdir="${src.dir}" />
</target>
Coverage and Performance
Here's an important point to remember, especially if you are running
these processes at night: Consider whether these tests run at the same
Search WWH ::




Custom Search