I believe I've implemented a reasonable solution.
The key points of the solution are: * Executing a task after the unit tests are complete, which only runs if "test.failed" * Use the "xmltask" task library to parse the test results files and emit concise results
I wrote the following target to do this:
<target name="show-unit-test-failures" if="test.failed">
<taskdef if:set="xmltask.present" name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
<echo if:set="xmltask.present" message="Unit test failure report details:"/>
<xmltask if:set="xmltask.present">
<fileset dir="gen/reports/artifacts/junit">
<include name="TEST-*Test.xml"/>
</fileset>
<call path="//testcase[./error]">
<parThatam name="className" path="@classname"/>
<param name="methodName" path="@name"/>
<param name="errorText" path="./error/text()"/>
<actions>
<echo>---------------------------------</echo>
<echo>@{className}.@{methodName}:</echo>
<echo>@{errorText}</echo>
</actions>
</call>
<call path="//testcase[./failure]">
<param name="className" path="@classname"/>
<param name="methodName" path="@name"/>
<param name="errorText" path="./failure/text()"/>
<actions>
<echo>---------------------------------</echo>
<echo>@{className}.@{methodName}:</echo>
<echo>@{errorText}</echo>
</actions>
</call>
</xmltask>
</target>
Note that I also let it "fail gracefully" if the "xmltask.jar" file isn't available. The ability to reference namespaces in tasks is a new feature in Ant 1.9.1 and newer.
I call this target at the end of my "run-unit-test" target.