instantiations.copy-test-results Ant Task

The instantiations.copy-test-results Ant task will copy JUnit test results into the dashboard's data store for future processing.

Installation

Download and unzip CodePro Server for Ant in a directory of your choice (e.g. /CodeProServer). To use the instantiations.copy-test-results Ant task you must add the following lines near the top of your Ant build script...

<property name="CodeProServer.install.dir" location="install-dir"/>
<import file="${CodeProServer.install.dir}/ant-tasks.xml" /> ...

where install-dir is the directory into which you installed CodePro Server for Ant.

Attributes

The following is a list of the attributes supported for the instantiations.copy-test-results task.

Attribute Description Required
buildNumber The build number associated with the most recent build. No
dataStore The location of the directory containing the data files from which the dashboard will be populated. Yes
projectName The name of the project containing the code that was tested (rather than the project containing the JUnit test code, if they are different.) Yes
srcDir The directory containing the JUnit result files to be copied. Yes

Examples

This example illustrates how copy-test-results can be used to store the results of a junit test run into the dashboard.

	<junit printsummary="yes" haltonfailure="no" 
			failureproperty="junit_test_failed" fork="true" forkmode="once">
		<classpath>
			<pathelement location="${java.build.test.classes}"/>
		</classpath>
		<classpath>
			<path refid="java.build.classpath"/>
			<pathelement location="${java.build.java.classes}"/>
		</classpath>
		<classpath>
			<pathelement location="${CodeProServer.install.dir}/ant-tasks.jar"/>
		</classpath>

		<formatter type="xml" />

		<batchtest todir="${build.out.tests}/report">
			<fileset dir="${java.build.java.test.src}">
				<include name="**/*Test.java" />
				<include name="**/*TestCase.java" />
				<exclude name="**/AllTests.java" />
				<exclude name="**/AnyTest.java" />
				<exclude name="**/Abstract*Test.java"/>
			</fileset>
		</batchtest>
	</junit>
	<instantiations.copy-test-results
			srcDir="${build.out.tests}/report"
			dataStore="${dashboard.data.store}"
			projectName="${project.name}"
			buildNumber="${build.num}">
	</instantiations.copy-test-results>