maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek (JIRA)" <>
Subject [jira] Commented: (SUREFIRE-701) showSuccess option for test reports: show reports only for failed tests
Date Thu, 17 Feb 2011 13:40:22 GMT


Alexander Klimetschek commented on SUREFIRE-701:

Patch description:

Attached is a patch that simply removes report files at the end of test execution if it was
successful (in AbstractFileReporter). Note: It is difficult to avoid writing the file in the
first place, since test logs are streamed directly to the file as the test runs (no buffering)
and you only know that a test was successful after it has completed. However, the remove-on-completion
works fine. Most of the many code changes apply to all the places where the new configuration
has to be stored and passed around. Since I had to extend the ReporterConfiguration constructor
with a new boolean parameter, there were places where the invocations via reflection had to
be changed. I hope I got them all right, normal mvn test calls work fine for me.

I haven't written a unit test for that, as I don't know which place would be the best (api
tests or integration-tests). To be able to run "mvn test" in the surefire projects itself
(all successful for me), I had to change the maven-surefire-plugin version in the root pom
to "2.7.3-SNAPSHOT" - it seems that useSystemClassLoader=false doesn't help, as I get reflection
exceptions with 2.7.2 (see below). However, with 2.7.3-SNAPSHOT you can't build from the reactor,
as maven stops detecting a cyclic reference now ;-)

[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ surefire-integration-tests ---
[INFO] Surefire report directory: /Users/alex/Day/code/maven-surefire/surefire-integration-tests/target/surefire-reports
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.NoSuchMethodException:<init>(java.util.List,,
java.lang.Boolean, java.lang.Integer); nested exception is java.lang.NoSuchMethodException:<init>(java.util.List,,
java.lang.Boolean, java.lang.Integer)
java.lang.NoSuchMethodException:<init>(java.util.List,, java.lang.Boolean, java.lang.Integer)
	at java.lang.Class.getConstructor0(
	at java.lang.Class.getConstructor(
	at org.apache.maven.surefire.util.ReflectionUtils.getConstructor(
	at org.apache.maven.surefire.booter.SurefireReflector.createReporterConfiguration(
	at org.apache.maven.surefire.booter.SurefireReflector.setReporterConfiguration(
	at org.apache.maven.surefire.booter.SurefireReflector.setReporterConfigurationAware(
	at org.apache.maven.surefire.booter.ProviderFactory.createProvider(
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(
	at org.apache.maven.surefire.booter.ForkedBooter.main(

As a side node, I think the code base could be simplified enormously if a generic configuration
system would be used (like property lists); the use of reflection contradicts with the hight
amount of type-enforcement done with the various config objects and type hierarchies. But
I guess this is a sign of evolution :-)

> showSuccess option for test reports: show reports only for failed tests
> -----------------------------------------------------------------------
>                 Key: SUREFIRE-701
>                 URL:
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.7.3
>            Reporter: Alexander Klimetschek
>         Attachments: showsuccess.patch
> Use case:
> When you have a few tests, and some of them fail during development/refactoring, you
find yourself repeatedly looking into target/surefire-reports to open the test report (txt)
files with the errors and stack traces to analyze them. However, by default reports will be
written also for successful tests, and both in txt and xml format (the xml files can already
be omitted using disableXmlReport=false). This makes it hard to find the files that contain
the failed tests.
> Solution proposal:
> Just as the maven-surefire-report-plugin already has a showSuccess option, that, if set
to "false", will not report successful tests, the same should be available for the maven-surefire-plugin
and the normal test goal.
> Either set "-DshowSuccess=false" on the command line or define "<showSuccess>false</showSuccess>"
in the maven-surefire-plugin configuration of the pom, and reports for successful tests should
not be written to the reports directory.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message