I have a product written in Java where I have many (over 250) separately-instrumented modules. Unfortunately, many of these modules have no coverage generated during our tests. However, I still need a coverage report generated for them, so that I have an accurate count of the total number of lines that are not covered in our product. Otherwise, I want exactly the same report that the clover-html-report ant task generates. It must be exactly the same because (a) people have gotten used to the report format, and (b) I run an XSLT to parse the summary HTML files to extract the actual coverage numbers I need for the product-wide summary that I generate.
I see that the clover-report task has an "alwaysReport" option, but it seems I can't use that without having to define the entire report format (including the columns, etc.), plus there doesn't seem to be a way to specify the outdir parameter.
Is there a way to convince clover-html-report to write out reports even when there is no coverage?
OK, here is exactly what I needed in order to produce exactly the same reports, with the only change being that the reports are always generated:
<clover-report initstring="${build.coverage.clover.dbdir}/${build.number}/@{module}/clover.db" coverageCacheSize="128m" > <current alwaysReport="true" outfile="${html.dir.local}/${build.number}/@{module}" title="Coverage for module @{module}"> <format type="html"/> </current> </clover-report>
The only problem now is that the reports for modules with no coverage end up with a date of 1/1/1970. Completely understandable - with no coverage, where would it remember a date? However, it would be better if it at least tried to use the same date as when the report was run.
The <clover-html-report> does not have the alwaysReport option. It means that you'd have to use a <clover-report> instead.
The <clover-report> task has an option to set the output directory - use the <current outfile="..."> or the <historical outfile="...">.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, if I change this:
<clover-html-report initstring="${build.coverage.clover.dbdir}/${build.number}/@{module}/clover.db" outdir="${html.dir.local}/${build.number}" title="Coverage for module @{module}" coverageCacheSize="128m" />
to this:
<clover-report initstring="${build.coverage.clover.dbdir}/${build.number}/@{module}/clover.db" coverageCacheSize="128m" > <current alwaysReport="true" outfile="${html.dir.local}/${build.number}" title="Coverage for module @{module}" /> </clover-report>
then I should get the same reports that I corrently do, with the addition of the empty reports?
One of the confusing things in the documentation: the "current" nested element says that the default format is XML, but the "format" nested element says that it is is omitted, an HTML report is generated. Which is it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Indeed, documentation was confusing, I just fixed it.
When the <current> has the summary="true" then the default format is PDF, otherwise it's XML.
You can change a report type by defining the <format type="html|pdf|xml|json"> tag inside the <current> (or the <historical>).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.