• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<project name="testng" default="all" basedir=".">
2
3  <property file="build.properties"/>
4  <property name="this.directory" value="${test.dir}" />
5  <property name="test-output" value="${this.directory}/test-output" />
6
7  <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${testng.jar}" />
8
9  <target name="all">
10    <echo>This dir: ${this.directory}</echo>
11    <delete failonerror="false" dir="${this.directory}/build" />
12  	<mkdir dir="${this.directory}/build" />
13
14  	<javac classpath="${testng.jar}"
15  		  destdir="${this.directory}/build" srcdir="${this.directory}" includes="test/ant/*.java" />
16
17<!--
18    <testng classpath="build;../../testng-5.2beta-jdk15.jar"
19            outputdir="test-output"
20    	      dumpcommand="true">
21        <xmlfileset dir="." includes="testng.xml"/>
22    </testng>
23-->
24	<delete failonerror="false">
25	<fileset dir="${test-output}" includes="**"/></delete>
26
27    <testng classpath="${this.directory}/build;${testng.jar}"
28            outputdir="${test-output}"
29  	    parallel="methods"
30  	    threadcount="5"
31    	listeners = "org.testng.reporters.FailedReporter, org.testng.reporters.DotTestListener"
32    	haltonfailure="true"
33    	>
34        <classfileset dir="${this.directory}/build">
35        	<include name="test/ant/NoPackageTest.class" />
36        	<include name="test/ant/MultipleThreadTest.class" />
37        </classfileset>
38    </testng>
39
40  	<available file="${test-output}/Ant suite/Ant test.xml"
41  		type="file" property="test.exists"/>
42  	<fail unless="test.exists"
43  		message="The appropriately named output should have been created"/>
44
45    <testng classpath="${this.directory}/build;${testng.jar}"
46            outputdir="${test-output}"
47	   	listeners = "org.testng.reporters.FailedReporter, org.testng.reporters.DotTestListener"
48    	haltonfailure="true"
49    	suitename="Test Ant Suite"
50    	testname="Test Ant Test"
51    	>
52        <classfileset dir="${this.directory}/build">
53        	<include name="test/ant/DontOverrideSuiteNameTest.class" />
54         </classfileset>
55    </testng>
56
57  	<available file="${test-output}/Test Ant Suite/Test Ant Test.xml"
58  		type="file" property="test2.exists"/>
59  	<fail unless="test2.exists" message="The appropriately named output should have been created"/>
60
61  	<!-- Ensure standard tests get run -->
62    <testng classpath="${this.directory}/build;${testng.jar}"
63            outputdir="${test-output}"
64    	listeners = "org.testng.reporters.FailedReporter, org.testng.reporters.DotTestListener"
65    	haltonfailure="true"
66    	>
67        <xmlfileset file="${test.resources.dir}/testng-ant.xml"/>
68    </testng>
69  	<available file="${test-output}/Suitename from xml/TestName.xml"
70  		type="file" property="test3.exists"/>
71  	<fail unless="test3.exists" message="The appropriately named output should have been created"/>
72
73  </target>
74</project>
75