Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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 ?

0 votes



4 answers

Permanent link
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

0 votes


Permanent link
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

0 votes


Permanent link
Hi Ryan,

Where did you attach this file com.ibm.team.build.toolkit_0.5.0.200801171139.jar ?

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jan 17 '08, 11:30 a.m.

Question was seen: 8,801 times

Last updated: Jan 17 '08, 11:30 a.m.

Confirmation Cancel Confirm