Sharing Report Formats

Still need help?

The Atlassian Community is here for you.

Ask the community

You can share report formats across a number of reports. This allows you to standardize on a set of report formats and use these for all of your reports.
Standalone format elements are created using the <clover-format> type. These standalone types support the same attributes and elements as the internal <format> elements of the <clover-report> task. To name the format, use the standard Ant "id" attribute.

The following code declares two report formats:

<clover-format id="std.format" srclevel="true" type="pdf"/>
<clover-format id="bw.format" bw="true" srclevel="true" type="pdf"/>

In this example, the first format is for source level, PDF reports. It is named "std.format". The second format, "bw.format", is essentially the same except that it specifies black-and-white output.
Once the format is declared with an identifier, it can be used by reference with a "refid" attribute. This is shown in the following report example:

<clover-report>
   <current summary="yes"  outfile="report-current.pdf"
                  title="Ant Coverage">
      <format refid="std.format"/>
   </current>
</clover-report>

This report, a summary report, uses the "std.format" format defined above. The refid values in the <format> elements can be an Ant property allowing selection of the report format at build time. The following is a complete example:

<target name="report">
   <clover-format id="std.format" srclevel="true" type="pdf"/>
   <clover-format id="bw.format" bw="true" srclevel="true" type="pdf"/>
   <property name="format" value="std.format"/>
   <clover-report>
      <current summary="yes"  outfile="report-current.pdf"
                    title="Ant Coverage">
         <format refid="${format}"/>
      </current>
      <historical historydir="clover-hist" outfile="report-history.pdf"
                    title="Ant Historical Coverage">
         <format refid="${format}"/>
      </historical>
</clover-report>
</target>

This example generated two reports, which share a format. The format defaults to the standard format, a color report. This default can be overriden from the command line. To generate black-and-white reports, use:

ant report \-Dformat=bw.format







Last modified on May 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.