JUnitLogPublisherTask
I saw this example that demontrates how to use JUnitLogPublisherTask with one test file.
<junit> <formatter type="xml" /> <test name="hello.test.HelloTest" outfile="HelloTest"/> <classpath> <pathelement path="${basedir}/hello.jar" /> <pathelement path="${junitJar}" /> </classpath> </junit> <junitLogPublisher filePath="HelloTest.xml" buildResultUUID="${buildResultUUID}" repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" /> I don't know how I can use this task with many test files. Because I have to use <batchtest> tag when I have many test files. And there is not the attribute "outfile" for this tag. For example, I have this code in a build.xml: <junit fork="yes" printsummary="yes" > <formatter type="xml"/> <classpath refid="test-classpath"/> <batchtest fork="yes" todir="${report.dir}"> <fileset dir="${source.test.dir}"> <include name="**/*Test.java"/> </fileset> </batchtest> </junit> How can I use JUnitLogPublisherTask with this code to publish the test results ? |
4 answers
The JUnitLogPublisherTask can only handle one file at a time, as you say. You may want to file an enhancement request asking that the task handle a fileset.
In the past, I have gotten around similar constraints by using the foreach ANT task. In your case it might look something like this: <target name="loop"> <foreach target="publish" param="in.file" delimiter=""> <path id="xml.files"> <fileset dir="${report.dir}"> <include name="*/*.xml" /> <!-- NOTE: here you would put the appropriate criteria for finding the files output by JUnit --> </fileset> </path> </foreach> </target> <target name="publish"> <junitLogPublisher filePath="${out.file}" buildResultUUID="${buildResultUUID}" repositoryAddress="${repositoryAddress}" userId="${userId}" password="${password}" /> </target> This approach requires that you have the ant-contrib tasks in your ANT library path. Martha |
The JUnitLogPublisherTask currently only supports publishing one xml log
file at a time. I've created a work item to improve this to support publishing a directory of xml logs. https://jazz.net/jazz/web/projects/Jazz%20Project#action=com.ibm.team.workitem.viewWorkItem&id=41526 I've attached a prototype patch (com.ibm.team.build.toolkit_0.5.0.200801171139.jar) that supports specifying a directory for the filePath attribute of JUnitLogPublisherTask. This patch only works with beta2 or beta2a. To use the patch, delete the existing buildtoolkit/com.ibm.team.build.toolkit_xxxxxxxx.jar. Then, copy in the patch jar. The file names are different due to the date stamp. Be sure you don't end up with both jars in the buildtoolkit directory. Let me know how this works for you. --- Ryan Manwiller Jazz Team Build |
Hi Ryan,
Where did you attach this file com.ibm.team.build.toolkit_0.5.0.200801171139.jar ? |
It is attached to my reply in the newsgroup. You may need to use a
newsreader to get it. I don't see attachments showing up on the jazz forum web page. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.