Daniel John Debrunner wrote:
Daniel John Debrunner wrote:
I made a simple change to build.xml to separate out the junit HTML report generation from junitreport which always ran junit-all.

The new target junit-html can be included as the last target in any junit ant run to produce an HTML report of all the tests run in that ant invocation.

E.g.

ant junit-clean junit-system-mini-codeline-jars junit-html

This needs a little more work, if a target fails before junit-html then junit-html is never executed and hence no report. E.g. due to these:

<fail if="tests.failed">Tests Failed!</fail>

Really need fail if "tests.failed" AND junit-html is not present
(another possibile check is "and not the last target"). No idea if this can be done in ant though. junit-html itself contains the fail test which would then cause the build to fail correctly after generating the report.
I had the same problem with the emma-targets, as mentioned in DERBY-3445. If there is no elegant way to solve this in ant, I guess it is possible to just restructure the targets so that only the "top level" targets, intended to be executed directly by a user, use

<fail if="tests.failed">Tests Failed!</fail>

These targets would mostly have no logic, just use "internal targets" and add the fail command. All the logic that is in the current top level junit- related targets could be moved to various internal targets that would not fail the build even if a test failed. These would be used by the top level targets and not intended for direct use.

Vemund

Reply via email to