1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
<project name="testng" default="all" basedir="..">
<property file="build.properties"/>
<property name="test15.dir" value="${basedir}/test"/>
<property name="test14.dir" value="${basedir}/test-14"/>
<property name="test.src.dir" value="${test15.dir}/src"/>
<property name="test.build.dir" value="${test15.dir}/build"/>
<property name="test14.src.dir" value="${test14.dir}/src"/>
<property name="test14.build.dir" value="${test14.dir}/build"/>
<property name="report.dir" value="${test15.dir}/test-output"/>
<property name="junit.report.dir" value="${report.dir}/test-tmp"/>
<property name="testng.report.dir" value="${report.dir}"/>
<target name="all" depends="prepare,compile,run,reports"/>
<!-- ==================================================================== -->
<!-- Compile -->
<!-- ==================================================================== -->
<path id="compile.cp">
<pathelement location="${build.jdk15.dir}"/>
<fileset dir="${lib.dir}">
<include name="junit.jar"/>
<include name="${beanshell.jar}"/>
<include name="${qdox.jar}"/>
</fileset>
</path>
<target name="env:info">
<echo>
BASEDIR =${basedir}
TEST15.DIR =${test15.dir}
TEST14.DIR =${test14.dir}
TEST.SRC.DIR =${test.src.dir}
TEST.BUILD.DIR =${test.build.dir}
REPORT.DIR =${report.dir}
JUNIT.REPORT.DIR =${junit.report.dir}
TESTNG.REPORT.DIR=${testng.report.dir}
</echo>
</target>
<target name="compile" depends="prepare">
<echo message=" -- Compiling JDK 1.5 tests --"/>
<property name="build.compiler" value="modern"/>
<javac debug="true"
source="1.5"
classpathref="compile.cp"
srcdir="${test.src.dir}"
destdir="${test.build.dir}"
/>
</target>
<target name="prepare">
<tstamp/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${junit.report.dir}"/>
<mkdir dir="${testng.report.dir}"/>
<taskdef name="testng"
classname="org.testng.TestNGAntTask"
classpath="${build.jdk15.dir}"/>
</target>
<!-- ==================================================================== -->
<!-- Run -->
<!-- ==================================================================== -->
<path id="run.cp">
<path refid="compile.cp"/>
<pathelement location="${test.build.dir}"/>
<pathelement location="${lib.dir}/${qdox.jar}"/>
<pathelement location="${java.home}/../lib/tools.jar"/>
</path>
<path id="run14.cp">
<path refid="compile.cp" />
<pathelement location="${test14.build.dir}" />
<pathelement location="${lib.dir}/${qdox.jar}" />
<pathelement location="${java.home}/../lib/tools.jar" />
</path>
<target name="run" description="Run tests" depends="compile">
<echo message=" -- Running JDK 1.5 tests --"/>
<echo message=" -- ${jdk15.testng.jar} --" />
<testng classpathref="run.cp" haltonfailure="true"
outputdir="${testng.report.dir}">
<xmlfileset dir="${test15.dir}" includes="testng.xml"/>
</testng>
</target>
<target name="run-jdk14" description="Run tests on javadoc annotations" depends="compile">
<echo message=" -- Running JDK 1.4 tests --"/>
<echo message=" -- ${jdk15.testng.jar} --" />
<testng classpathref="run14.cp"
outputdir="${testng.report.dir}"
sourcedir="${test14.src.dir}"
annotations="javadoc">
<xmlfileset dir="${test14.dir}" includes="testng.xml"/>
</testng>
</target>
<target name="run:single" description="Run 1 property file named with the ant property test" depends="compile">
<echo message=" -- testng-tests-run1 --"/>
<testng outputdir="${testng.report.dir}"
classpathref="run.cp">
<xmlfileset dir="${test15.dir}" includes="testng-single.xml"/>
</testng>
<echo>Report created in ${testng.report.dir}</echo>
</target>
<!-- ==================================================================== -->
<!-- Run specific configuration -->
<!-- ==================================================================== -->
<target name="run:conf"
if="testng.conf"
depends="clean:reports,compile"
description="Run specified tests">
<echo message=" -- testng-tests-run --"/>
<echo message="using: ${testng.conf}.xml"/>
<testng classpathref="run.cp"
outputDir="${testng.report.dir}">
<xmlfileset dir="${test15.dir}" includes="${testng.conf}.xml"/>
</testng>
<antcall target="clean.tmp"/>
</target>
<!-- ==================================================================== -->
<!-- Reports -->
<!-- ==================================================================== -->
<target name="reports">
<junitreport todir="${junit.report.dir}">
<fileset dir="${testng.report.dir}">
<include name="*.xml"/>
<exclude name="testng-failed.xml"/>
<exclude name="testng-results.xml" />
</fileset>
<report format="noframes" todir="${junit.report.dir}"/>
</junitreport>
</target>
<target name="clean.tmp">
<delete dir="${basedir}/test-output-tests"/>
</target>
<target name="clean:reports">
<delete dir="${report.dir}"/>
<delete dir="${junit.report.dir}"/>
</target>
<target name="clean" depends="clean.tmp,clean:reports">
<echo message=" -- test clean --"/>
<delete dir="${test.build.dir}"/>
</target>
</project>
|