added simple, initial test framework
authormaxcooper <maxcooper>
Tue, 6 May 2003 13:54:04 +0000 (13:54 +0000)
committermaxcooper <maxcooper>
Tue, 6 May 2003 13:54:04 +0000 (13:54 +0000)
build.properties.sample
build.xml
deploy.xml
properties.xml

index 07154ad..24a0f86 100644 (file)
@@ -5,7 +5,7 @@
 # Security Filter. Copy this file to "build.properties" and make any changes
 # you want to use custom values.
 #
-# $Id: build.properties.sample,v 1.4 2003/05/05 11:38:27 maxcooper Exp $
+# $Id: build.properties.sample,v 1.5 2003/05/06 13:54:04 maxcooper Exp $
 # -----------------------------------------------------------------------------
 
 # -----------------------------------------------------------------------------
@@ -17,8 +17,7 @@
 #
 # If these values are not set, the default values listed below will be used.
 # -----------------------------------------------------------------------------
-#tomcat.host=localhost
-#tomcat.port=8080
+#tomcat.url=http://localhost:8080
 #tomcat.username=admin
 #tomcat.password=password
 
index cecb3d6..c656675 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 
 <!--
-$Id: build.xml,v 1.17 2003/05/05 11:38:27 maxcooper Exp $
-$Revision: 1.17 $
-$Date: 2003/05/05 11:38:27 $
+$Id: build.xml,v 1.18 2003/05/06 13:54:04 maxcooper Exp $
+$Revision: 1.18 $
+$Date: 2003/05/06 13:54:04 $
 -->
 
 <!DOCTYPE project [
@@ -219,8 +219,42 @@ $Date: 2003/05/05 11:38:27 $
 
    <!-- ========== Test Target ===================================================================================== -->
 
-   <target name="test" depends="deploy" description="tests webapp(s) on server(s)">
-      <echo>No tests yet, but they're coming soon!</echo>
+   <target name="test" depends="deploy,test-compile" description="tests webapp(s) on server(s)">
+      <mkdir dir="${build.test.data.dir}"/>
+      <junit printsummary="false"
+         errorProperty="test.failed"
+         failureProperty="test.failed"
+         fork="true">
+         <classpath refid="functional-test.classpath"/>
+         <sysproperty key="base.url" value="${tomcat.url}/${project.name}-example"/>
+         <formatter type="xml"/>
+         <formatter type="brief" usefile="false"/>
+         <test name="${testcase}" if="testcase"/>
+         <batchtest todir="${build.test.data.dir}" unless="testcase">
+            <fileset dir="${src.test.dir}" includes="**/*Test.java"/>
+         </batchtest>
+      </junit>
+      <mkdir dir="${build.test.reports.dir}"/>
+      <junitreport todir="${build.test.data.dir}">
+         <fileset dir="${build.test.data.dir}">
+            <include name="TEST-*.xml"/>
+         </fileset>
+         <report format="frames" todir="${build.test.reports.dir}"/>
+      </junitreport>
+      <fail message="Functional tests failed" if="test.failed"/>
+   </target>
+
+   <target name="test-compile">
+      <mkdir dir="${build.test.classes.dir}"/>
+      <javac
+         srcdir="${src.test.dir}"
+         destdir="${build.test.classes.dir}"
+         debug="${compile.debug}"
+         debuglevel="${compile.debuglevel}"
+         optimize="${compile.optimize}"
+         deprecation="${compile.deprecation}">
+         <classpath refid="test-compile.classpath"/>
+      </javac>
    </target>
 
    <!-- ========== All Target ====================================================================================== -->
index 8d0a450..3893148 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 
 <!--
-$Id: deploy.xml,v 1.1 2003/05/05 11:38:27 maxcooper Exp $
-$Revision: 1.1 $
-$Date: 2003/05/05 11:38:27 $
+$Id: deploy.xml,v 1.2 2003/05/06 13:54:04 maxcooper Exp $
+$Revision: 1.2 $
+$Date: 2003/05/06 13:54:04 $
 -->
 
 <!DOCTYPE project [
@@ -29,14 +29,7 @@ $Date: 2003/05/05 11:38:27 $
       <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" classpath="${catalina-ant.jar}"/>
       <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" classpath="${catalina-ant.jar}"/>
 
-      <!-- default values for tomcat deployment -->
-      <property name="tomcat.host" value="localhost"/>
-      <property name="tomcat.port" value="8080"/>
-      <property name="tomcat.username" value="admin"/>
-      <property name="tomcat.password" value="password"/>
-
       <property name="webapp.path" value="/${webapp.name}"/>
-      <property name="tomcat.url" value="http://${tomcat.host}:${tomcat.port}"/>
       <property name="tomcat.manager.url" value="${tomcat.url}/manager"/>
    </target>
 
index 785b431..6bf04ca 100644 (file)
@@ -1,7 +1,7 @@
 <!--
-$Id: properties.xml,v 1.3 2003/05/05 11:53:12 maxcooper Exp $
-$Revision: 1.3 $
-$Date: 2003/05/05 11:53:12 $
+$Id: properties.xml,v 1.4 2003/05/06 13:54:04 maxcooper Exp $
+$Revision: 1.4 $
+$Date: 2003/05/06 13:54:04 $
 -->
 
 <!--
@@ -32,9 +32,18 @@ $Date: 2003/05/05 11:53:12 $
 
 <!-- ========== Build System Support Library Properties ============================================================ -->
 
-<property name="ant-contrib.jar" location="lib/ant-contrib.jar"/>
+<property name="ant-contrib.jar" location="${lib.dir}/ant-contrib.jar"/>
+<property name="junit.jar" location="${lib.dir}/junit.jar"/>
+<property name="httpunit.jar" location="${lib.dir}/httpunit.jar"/>
+<property name="tidy.jar" location="${lib.dir}/Tidy.jar"/>
 <property name="catalina-ant.jar" location="${env.CATALINA_HOME}/server/lib/catalina-ant.jar"/>
 
+<!-- ========== Tomcat Properties ================================================================================== -->
+
+<property name="tomcat.url" value="http://localhost:8080"/>
+<property name="tomcat.username" value="admin"/>
+<property name="tomcat.password" value="password"/>
+
 <!-- ========== Core Properties ==================================================================================== -->
 
 <!-- name of this project -->
@@ -46,7 +55,7 @@ $Date: 2003/05/05 11:53:12 $
 <!-- Should Java compilations set the debug compiler option? -->
 <property name="compile.debug" value="true"/>
 <!-- What debug information should be included if compile.debug is true? -->
-<property name="compile.debuglevel" value="lines,vars"/>
+<property name="compile.debuglevel" value="lines,vars,source"/>
 
 <!-- Should Java compilations set the deprecation compiler option? -->
 <property name="compile.deprecation" value="true"/>
@@ -64,7 +73,13 @@ $Date: 2003/05/05 11:53:12 $
 <property name="build.docs.dir" location="${build.dir}/documentation"/>
 <property name="build.docs.api.dir" location="${build.docs.dir}/api"/>
 
+<property name="build.test.dir" location="${build.dir}/test"/>
+<property name="build.test.classes.dir" location="${build.test.dir}/classes"/>
+<property name="build.test.data.dir" location="${build.test.dir}/data"/>
+<property name="build.test.reports.dir" location="${build.test.dir}/reports"/>
+
 <property name="src.dir" location="src"/>
+<property name="src.test.dir" location="${src.dir}/test"/>
 <property name="src.share.dir" location="${src.dir}/share"/>
 <property name="src.catalina.dir" location="${src.dir}/catalina"/>
 
@@ -92,6 +107,20 @@ $Date: 2003/05/05 11:53:12 $
    <pathelement location="${servlet.jar}"/>
 </path>
 
+<!-- test compile classpath -->
+<path id="test-compile.classpath">
+   <path refid="compile.classpath"/>
+   <pathelement location="${junit.jar}"/>
+   <pathelement location="${httpunit.jar}"/>
+</path>
+
+<!-- test run classpath -->
+<path id="functional-test.classpath">
+   <path refid="test-compile.classpath"/>
+   <pathelement location="${tidy.jar}"/>
+   <pathelement location="${build.test.classes.dir}"/>
+</path>
+
 <!-- Standard Token Replacement Filterset -->
 <filterset id="project.filterset">
    <filter token="PROJECT.VERSION" value="${project.version}"/>