Enterprise Java

Apache Ant 1.10.10 released – Better test result summary from junitlauncher task

Apache Ant 1.10.10 got released around a month back. Among the usual bug fixes, we added a new enhancement for the “junitlauncher” task.

For those of you who haven’t used or know about “junitlauncher” task, it’s a new task we introduced a few years back to allow projects using Ant, to be able to use the new JUnit5 testing framework. The previous (and still supported) “junit” task is meant to be used only if you want to continue using just JUnit4. If you plan to use JUnit5 (which also supports JUnit4 style testcases), then you will have to use the “junitlauncher” task.

This “junitlauncher” task has been around for a few years now and some users have reported that its “printSummary” feature isn’t of much use. People familiar with the “junit” task will know that when a test gets run, the task prints an instantaneous summary like:

org.myapp.foo.bar.SimpleTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec

This is useful to see a quick summary of the tests being run.

The “junitlauncher” has a “printSummary” attribute which until Ant 1.10.10 version used to print a summary after all the tests had been executed. Furthermore, the printed summary was a summary that the JUnit5 framework generates by default, something like:

[junitlauncher]
[junitlauncher] Test run finished after 5103 ms
[junitlauncher] [         2 containers found      ]
[junitlauncher] [         0 containers skipped    ]
[junitlauncher] [         2 containers started    ]
[junitlauncher] [         0 containers aborted    ]
[junitlauncher] [         2 containers successful ]
[junitlauncher] [         0 containers failed     ]
[junitlauncher] [         1 tests found           ]
[junitlauncher] [         0 tests skipped         ]
[junitlauncher] [         1 tests started         ]
[junitlauncher] [         0 tests aborted         ]
[junitlauncher] [         1 tests successful      ]
[junitlauncher] [         0 tests failed          ]

As you can see, summary of this form isn’t really useful. So some of the Ant users requested (https://bz.apache.org/bugzilla/show_bug.cgi?id=64836) this to be improved to provide a summary which resembled what we have with the “junit” task.

This Ant 1.10.10 release now consists that enhancement. When you use “printSummary=true” on the “junitlauncher” task, it will now print a more useful and immediate summary like the “junit” task does:

Running org.myapp.foo.bar.SimpleTest Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec

As usual, the release is available for download at the Ant downloads page https://ant.apache.org/bindownload.cgi. Please give this a try and if you have any suggestion or feedback on this release, please get in touch with us on our mailing lists https://ant.apache.org/mail.html or our issue tracker https://ant.apache.org/bugs.html.

Published on Java Code Geeks with permission by Jaikiran Pai, partner at our JCG program. See the original article here: Apache Ant 1.10.10 released – Better test result summary from junitlauncher task

Opinions expressed by Java Code Geeks contributors are their own.

Jaikiran Pai

Jaikiran works for Red Hat and is a developer in the JBoss application server development team. He's one of the authors of "JBoss AS Getting Started" DZone RefCard. When he's not doing anything JBoss related, you can usually find him at JavaRanch, in his role as a Sheriff(Moderator). He blogs at jaitechwriteups
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button