Generating reports from an Ant task on a local computer

If you are working with code coverage outside the workbench on the same computer where you installed your development workbench, then you can generate reports using an Ant task provided by the code coverage feature.

About this task

This task uses the reporting functionality provided by the BIRT Eclipse.org project. You must download the BIRT 2.6.x Reporting Engine standalone offering.

Procedure

  1. Download the BIRT report generation:
    1. In a web browser, open http://www.eclipse.org/birt and select to download version 2.6.x. Download only the Report Engine offering.
    2. Extract the contents of the Report Engine compressed file that you downloaded in the previous step.
  2. Generate reports using the code-coverage-report Ant task. The following example is an Ant task for generating a report on a local development computer:
    <target name="generate-report">
    	<path id="lib.path">
    <pathelement location="<Installation location of product>\plugins\plugins\com.ibm.rational.llc.report_<date>"/>
    <pathelement location="<Installation location of product>\plugins\com.ibm.rational.llc.common__<date>.jar"/>
    <pathelement location="<Installation location of product>\plugins\org.eclipse.equinox.common_<date>.jar"/>
    <fileset dir="<BIRT Report Engine home>/lib" includes="*.jar"/>
    </path>
    <taskdef name="code-coverage-report" classname="com.ibm.rational.llc.report.birt.adapters.ant.ReportGenerationTask" classpathref="lib.path"/>
    <code-coverage-report
        outputDir="${reportDir}"
        coverageDataFile="${coverageOutputFile}"
        baseLineFiles="${baseLineFile}"
        reportFileDirectory="${code-coverage-report-dir}"
        birtHome="${birt-report-engine}">
        <filters>
            <filter type="" value=""/>
        </filters>
        <configurations>
           <configuration name="" value="" />
        </configurations>
    </code-coverage-report>
    </target>
    The task parameters are described in the following table:
    Property Description
    outputDir [Output] A path to a directory used to store the output of the report generation step
    coverageDataFile [Input] The coveragedata statistics file generated in the execution step
    reportFileDirectory [Input] The directory containing the report design files.
    baseLineFiles [Input] The baseline file generated for the application in the analysis step
    birtHome [Input] The location of the BIRT Report Engine. This is the location of the ReportEngine directory.
    filters: Optional: Used for filtering report results. It contains one or more filter elements.
    filter: Contained by the filters property.
    • type: The type of filter to apply to the report.
    • value: The value of the filter to apply to the report.
    Line Coverage Threshold filter: Sets a threshold for the line coverage report to display data below the specified percentage value.
    • type=line_coverage_threshold
    • value=threshold value
    For example:
    <filters>
            <filter type="line_coverage_threshold" value="80" />
        </filters>
    Configurations Optional: Used for specifying various calculation configurations. It contains one or more configuration elements.
    Configuration: Contained by the configurations property.
    • name: The configuration name.
    • value: The value of the configuration.
    Default constructor inclusion:: Configure whether default constructors are excluded or included in the code coverage computations. By default, the default constructors are included. If a class does not define any constructors, then the compiler generates a default no argument constructor. However this constructor does not show up in the actual source file. During the program execution if this class is not instantiated then this hidden default constructor is not executed and hence the coverage does not come equate to 100 percent as expected.
    • name=excludeDefaultConstructor
    • value=true or false
    For example:
    <configurations>
        <configuration name="excludeDefaultConstructor" value="true"/> 
     </configurations>

Feedback