I have a Maven Surefire report that generates 3 files:
TESTS-TestSuites.xml - shows only passing tests. no info about fails or errors.
TEST-me.qa.MyTest.xml - see below
me.qa.MyTest.txt - file containing console output showing exceptions
Each failing test, shows an error in the TEST-me.qa.MyTest.xml file like this:
<testcase name="testIPcheckCanCalculate" classname="me.qa.TestLogChecks" time="0.016">
<failure message="Average is too low: 0.5357142857142857. Min: 20.0"
type="java.lang.AssertionError">java.lang.AssertionError: Average is too low:
0.5357142857142857. Min: 20.0
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at me.qa.TestLogChecks.testIPcheckCanCalculate(TestLogChecks.java:230)
</failure>
<system-out>Testing InPreparer.getInv().getSomething().checkCanCalculate() ...
</system-out>
</testcase>
Can maven-antrun-plugin generate a HTML report showing the exception errors (and fails) ? Currently, the JUNit output file, called junit-noframes.html , only shows information in the TESTS-TestSuites.xml and so no failure information at all is being shown (even though my include is for *.xml). My workaround is to also look inside the me.qa.MyTest.txt file to see what the errors are, but I want those errors to appear on my report and also show a failed total number of tests on the report.
Here is my Maven config:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>test-reports</id>
<phase>test</phase>
<configuration>
<tasks>
<junitreport todir="target/surefire-reports">
<fileset dir="target/surefire-reports">
<include name="**/*.xml" />
</fileset>
<report format="frames" todir="target/surefire-reports" />
</junitreport>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
OR, am I doing this all wrong and can Surefire itself generate a suitable report?
I solved it. Iinstead of using the maven-antrun-plugin I am now using the maven-surefire-report plugin along with the goal site maven-surefire:report . NOTE: You need to run the site goal first in order to generate the CSS files for the report.