changes.
| ![](https://wiki.pmease.com/images/icons/nav_down.gif) | To add JUnit report, only need two steps: |
| # Add generate JUnit report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tools |
| # Add publish JUnit report step in the QuickBuild |
| | To publish [JUnit|http://www.junit.org] report, you only need two steps: |
| # Generate JUnit *XML* report from [Ant|http://ant.apache.org] or [Maven|http://maven.apache.org] or any other build tool. |
| # Add a JUnit report publish step by choosing _Publish -> Junit Report_ in step menu. |
| |
| h2. Generate JUnit Report |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | QuickBuild will NOT generate JUnit report automatically, so first make sure the JUnit report is produced by [ANT|http://ant.apache.org] or by any other build tools, the following example shows how to generate JUnit test results by [Ant JUnit task|http://ant.apache.org/manual/OptionalTasks/junit.html]: |
| |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | QuickBuild will NOT generate [JUnit|http://www.junit.org] report automatically, so first make sure the [JUnit|http://www.junit.org] report is produced by [ANT|http://ant.apache.org] or by any other build tool. The following example shows how to generate JUnit test results with [Ant JUnit task|http://ant.apache.org/manual/OptionalTasks/junit.html] and aggregate all the test reports into one by using [Ant JUnitReport task|http://ant.apache.org/manual/OptionalTasks/junitreport.html] (this is not required): |
| {code:xml|title=JUnit target in build.xml} |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | <target name="junit"> |
| <junit printsummary="yes" haltonfailure="yes"> |
| <classpath> |
| <pathelement location="${build.tests}"/> |
| <pathelement path="${java.class.path}"/> |
| </classpath> |
| |
| <formatter type="xml"/> <!-- DO use xml here --> |
| |
| <batchtest fork="yes" todir="reports/junit"> |
| <fileset dir="${src.tests}"> |
| <include name="**/*Test*.java"/> |
| <exclude name="**/AllTests.java"/> |
| | <target name="junit" depends="compile.test"> |
| <mkdir dir="${junit.report.dir}" /> |
| <mkdir dir="${junit.report.dir}/test-out" /> |
| <record name="${junit.report.dir}/test-output.txt" append="no" action="start"/> |
| <junit printsummary="yes" haltonfailure="false" fork="yes"> |
| <classpath refid="test.classpath"/> |
| <formatter type="xml"/> |
| <batchtest fork="yes" todir="${junit.report.dir}/test-out"> |
| <fileset dir="${test.home}"> |
| <include name="**/*Test.java"/> |
| <exclude name="**/*AbstractTest.java"/> |
| </fileset> |
| </batchtest> |
| </junit> |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | </target> |
| {code} |
| |
| The code snippet will generate the XML reports for each test case, and the reports will be captured to 'reports/junit' directory. You may also want to merge all the test case report by using [Ant JUnitReport task|http://ant.apache.org/manual/OptionalTasks/junitreport.html] like: |
| {code:xml|title=JUnitReport task in build.xml} |
| <target name="junit"> |
| <junit> |
| ... ... |
| </junit> |
| |
| <junitreport todir="${outputdir}"> |
| <fileset dir="reports/junit"> |
| | <junitreport todir="${junit.report.dir}"> |
| <fileset dir="${junit.report.dir}/test-out"> |
| <include name="TEST-*.xml"/> |
| </fileset> |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | <report todir="${outputdir}/html" |
| styledir="junitreport" |
| format="frames"> |
| <param name="key1" expression="value1"/> |
| <param name="key2" expression="value2"/> |
| </report> |
| </junitreport> |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | </target> |
| | <record name="${junit.report.dir}/test-output.txt" action="stop"/> |
| </target> |
| {code} |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | The code snippet will generate the XML reports for each test case, and the reports will be captured to '$\{junit.report.dir\}' directory. |
| |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | ![](https://wiki.pmease.com/images/icons/nav_down.gif) | After adding generate the XML report(s) for your test results, you can tell QuickBuild to add those results now. |
| | {note:title=About haltonfailure} |
| If 'haltonfailure' in junit task is defined to true, the junit reports are not complete. If you want to generate the full reports, set 'haltonfailure' to false. |
| {note} |
| |
![](https://wiki.pmease.com/images/icons/nav_up.gif) | | h2. Adding JUnit Report |
| Just like all other [build reports|Build Reports], to add JUnit report is by adding a publish step in a [configuration|Configuration]. |
| | h2. Publish JUnit Report |
| |
| Just like all other [build reports|Publish Build Reports], you add JUnit report by [adding a publish step|Working With Step] in a [configuration|Working with Configurations]. When you add publish JUnit Report step, the following screen will be displayed: |
| |
| !Screenshots^report_publish_step.png! |
| |
| In Report Files/Patterns field, QuickBuild uses Ant style file patterns to collect the reports, and the directory you specified is *relative* to the workspace directory. |
| {note} |
| Please don't publish the aggregated report with the test reports together. That is, if you have aggregated the test reports, then you only need publish the aggregated one. |
| {note} |
| |
| If you have several report sets, you can add several publish JUnit steps with different report set names. |