JAL-1270 JUnit to TestNG refactoring
[jalview.git] / build.xml
index c079df9..dbf1df3 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <property name="jsonSimple" value="json_simple-1.1.jar" />
     <property name="javaJson" value="java-json.jar" />
     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
+       <property name="reportDir" value="test-reports" />
+       <property name="testDir" value="test" />
+       <property name="testOutputDir" value="tests" />
     <!-- switch to indicate if we should obfuscate jalviewLite -->
     <!-- <property name="donotobfuscate" value="true"/> -->
     <!-- switch to exclude associations from generated jnlp files -->
       <exclude name="com/stevesoft/**" />
     </javac>
   </target>
+  
+  
+  <target name="testclean" depends="init">
+    <delete dir="${testOutputDir}" includes="*,**/*"/>
+  </target>
+  
+  <target name="prepareTests" depends="init">
+       <mkdir dir="${testOutputDir}" />
+       <copy todir="${testOutputDir}">
+               <fileset dir=".">
+                       <include name="${docDir}/**/*.*" />
+                       <include name="${helpDir}/**/*.*" />
+                       <include name="${libDir}/*.jar" />
+               </fileset>
+               <fileset dir="${resourceDir}">
+                       <include name="**/*.*" />
+               </fileset>
+       </copy>
+  </target>  
+  
+  <target name="buildTests" depends="prepareTests">
+       <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${testOutputDir}"
+               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+               <exclude name="jalview/*applet*" />
+               <exclude name="jalview/appletgui/**" />
+       </javac>
+       <javac source="1.5" target="1.5" srcdir="${testDir}" destdir="${testOutputDir}"
+               debug="${javac.debug}" classpathref="build.classpath" includeantruntime="false" >
+       </javac>
+  </target>
+  
+  <taskdef name="testng" classname="org.testng.TestNGAntTask" >            
+       <classpath location="utils/testnglibs/testng.jar" />
+  </taskdef>
+  
+  <target name="testng" depends="buildTests">
+       <testng classpathref="build.classpath" outputDir="${reportDir}"
+               haltOnFailure="false">
+               <classpath location="${testOutputDir}" />
+               <xmlfileset dir="utils" includes="jalview_testng.xml" />
+       </testng>
+  </target>
+  
   <target name="buildindices" depends="init, prepare" unless="help.uptodate">
     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
       <arg line="html" />