Summary: | Make XmlFormatter for junittask (optinally) lighter | ||
---|---|---|---|
Product: | Ant | Reporter: | gui <janssk1> |
Component: | Optional Tasks | Assignee: | Ant Notifications List <notifications> |
Status: | NEW --- | ||
Severity: | enhancement | Keywords: | PatchAvailable |
Priority: | P2 | ||
Version: | 1.6.2 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Bug Depends on: | 32973 | ||
Bug Blocks: | |||
Attachments: | prevents XMLJUnitFormatter from outputting properties unless the verbose flag is set |
Description
gui
2005-01-06 22:32:10 UTC
Created attachment 14310 [details]
prevents XMLJUnitFormatter from outputting properties unless the verbose flag is set
eg:
<junit printsummary="yes" fork="yes" haltonfailure="no">
<classpath>
<pathelement location="${build.dir}" />
<pathelement location="${lib.dir}/junit/junit.jar" />
</classpath>
<formatter type="xml" usefFile="true" verbose="false"/>
</junit>
tested on WindowsXP with JDK1.5.0, using HEAD. tested with fork="yes" and
fork"no". Under test, brought the file size of the XML generated down by 75%
(from 8Kb -> 2Kb). Sorry no JUnit tests for this (ironically I suppose)
On a quick look at the patch, I noticed one problem. The interface "JUnitResultFormatter" has been extended with one new method (setVerbose). As JUnitResultFormatter is a public interface, and is the way for 3'th party formatters to be added to ant, the change is not backward compatible. Damn! Sorry about that. Can you suggest a way to refactor the code, I'd be willing to do the work, but I can't see how to make this change right now (brain freeze). I can think of using ant-types <formatter usefile="yes"> <junit.xmlformatter verbose="yes"/> </formatter> Change to Formatter.java: private JUnitResultFormatter byReflection; public void add(JUnitResultFormatter byReflection) { this.byReflection = byReflection; } /** * @since Ant 1.6 */ JUnitResultFormatter createFormatter(ClassLoader loader) throws BuildException { JUnitResultFormatter r = byReflection; if (byReflection == null) { .... } } if (useFile && outFile != null) { try { out = new FileOutputStream(outFile); } catch (java.io.IOException e) { throw new BuildException(e); } } r.setOutput(out); return r; } * not tested completly * |