The code you pasted is the equivalent of calling a junitreport task:
<junitreport todir=".."> <fileset dir=".."> <include name="TEST-*.xml" /> </Fileset> <report format="frames" todir=".." /> </Junitreport>
You need to put this in a method and run it yourself. This code will accept all files with the name TEST-*.xml and create a report with them. He will not create these files. These files are created using the junit task in Ant. Therefore you need to:
- Programmatically execute the junit task (see JUnitTask (Apache Ant API) ), ensuring that TEST * .xml files are created somewhere in the temp directory somewhere.
- Run the code above to create the report using these temporary files.
The easiest way to do this is probably what you did, have build.xml somewhere and call Ant directly. If the set of files you use is stable, then this is probably the easiest way. Use this class ProcessBuilder .
source share