changes.
| To add [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. |
| # Publish JUnit report in the [configuration|1. Working with Configuration]. |
| |
| h2. Generate JUnit Report |
| |
| 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]: |
| {code:xml|title=JUnit target in build.xml} |
| <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="yes" 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> |
| <junitreport todir="${junit.report.dir}"> |
| <fileset dir="${junit.report.dir}/test-out"> |
| <include name="TEST-*.xml"/> |
| </fileset> |
| </junitreport> |
| <record name="${junit.report.dir}/test-output.txt" action="stop"/> |
| </target> |
| {code} |
| The code snippet will generate the XML reports for each test case, and the reports will be captured to '$\{junit.report.dir\}' directory. |
| |
| h2. Publish JUnit Report |
| |
| Just like all other [build reports|06. Publish Build Reports], you add JUnit report by [adding a publish step|Working With Step] in a [configuration|1. Working with Configuration]. When you add publish JUnit Report step, the following screen will be displayed: |
| |
| !junit_step.png! |
| |
| In source files field, QuickBuild uses Ant style file patterns to collect the reports, and the directory you specified is *relative* to the [workspace|Workspace Directory] directory. |
| | {info:title=More on JUnit Report} |
| The default JUnit plugin setting only accepts the reports which have been aggregated by using 'junitreport' task. |
| {info} |