テストリポート出力環境のテンプレート

project.properties

# ソースディレクトリ
src=src
# .class出力ディレクトリ
build=bin
# JARライブラリディレクトリ
lib=lib
# レポートソース出力ディレクトリ
report.src=report/src
# レポート出力ディレクトリ
report=report

build.xml

<project default="test" basedir=".">

	<property file="project.properties" />

	<fileset id="classpath" dir="${lib}">
		<include name="*" />
	</fileset>

	<target name="test" depends="compile">
		<mkdir dir="${report}" />
		<mkdir dir="${report.src}" />
		<junit fork="yes">
			<formatter type="xml" usefile="true" />
			<classpath>
				<fileset refid="classpath" />
				<pathelement path="${build}" />
			</classpath>
			<batchtest fork="yes" todir="${report.src}">
				<fileset dir="${build}">
					<include name="**/*Test.class" />
					<exclude name="**/AllTests.class" />
				</fileset>
			</batchtest>
		</junit>
		<junitreport todir="${report.src}">
			<fileset dir="${report.src}">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="noframes" todir="${report}" />
		</junitreport>
	</target>

	<target name="compile">
		<javac srcdir="${src}" destdir="${build}" debug="on">
			<classpath>
				<fileset refid="classpath" />
			</classpath>
		</javac>
	</target>

</project>