You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/12/31 16:37:51 UTC

cvs commit: jakarta-turbine-3/src/test/org/apache/turbine BaseTestCase.java

jvanzyl     01/12/31 07:37:51

  Modified:    .        build-test.xml build.xml default.properties
               src/test/org/apache/turbine BaseTestCase.java
  Log:
  - Using the same testing pattern used in stratum where a set of test
    reports are created in a directory for easy viewing. The <junit> task
    can also produce an XML output that we could process with DVSL to produce
    nice reports of the tests if we wished.
  
  - Added dom4j to the mix as it is required by the mapper for converting
    the pipeline XML descriptors into an object model.
  
  - The test for the pipeline mapping is complete. Hopefully we can start
    a trend of adding the test first, discussing and than implementing
    in the code base.
  
  Revision  Changes    Path
  1.2       +54 -66    jakarta-turbine-3/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build-test.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build-test.xml	16 Aug 2001 04:41:24 -0000	1.1
  +++ build-test.xml	31 Dec 2001 15:37:51 -0000	1.2
  @@ -1,85 +1,73 @@
  -<project name="turbine-tests" default="run-tests" basedir=".">
  -    
  -  <!-- Build classpath -->
  -  <path id="classpath">
  -    <pathelement location="${velocity.jar}"/>
  -    <pathelement location="${log4j.jar}"/>
  -    <pathelement location="${servlet.jar}"/>
  -    <pathelement location="${fulcrum.jar}"/>
  -    <pathelement location="${regexp.jar}"/>
  -    <pathelement location="${torque.jar}"/>
  -    <pathelement location="${jaf.jar}"/>
  -    <pathelement location="${xerces.jar}"/>
  -    <pathelement location="${commons-collections.jar}"/>
  -    <pathelement location="${commons-util.jar}"/>
  -    <pathelement location="${junit.jar}"/>
  -  </path>
  +<?xml version="1.0"?>
   
  -  <target name="check_available">
  -    <available property="junit.present"
  -      classname="junit.framework.TestCase">
  -      <classpath refid="classpath"/>
  -    </available>
  -  </target>
  -
  -  <target name="prepare" depends="check_available">
  +<project name="Stratum" default="test" basedir=".">
   
  -    <copy todir="${build.src}/org" filtering="yes">
  -      <fileset dir="${src.test.dir}/org"/>
  -    </copy>
  +  <!-- Allow any user specific values to override the defaults -->
  +  <property file="${user.home}/build.properties" />
  +  <!-- Allow user defaults for this project -->
  +  <property file="build.properties" />
  +  <!-- Set default values for the build -->
  +  <property file="default.properties" />
   
  -    <javac srcdir="${build.src}"
  -      destdir="${build.dest}"
  -      excludes="**/package.html"
  -      debug="${debug}"
  -      deprecation="${deprecation}"
  -      optimize="${optimize}">
  -
  -      <classpath refid="classpath"/>
  -    </javac>
  -
  -  </target>
  +  <!-- Construct compile classpath -->
  +  <path id="classpath">
  +    <pathelement location="${dom4j.jar}"/>
  +    <pathelement location="${junit.jar}"/>
  +    <pathelement location="${commons-beanutils.jar}"/>
  +    <pathelement location="${commons-util.jar}"/>
  +    <pathelement location="${stratum.jar}"/>
  +    <pathelement location="${build.dest}"/>
  +  </path>
   
     <!-- ================================================================== -->
  -  <!-- Run testcases                                                      -->
  +  <!-- T E S T                                                            -->
     <!-- ================================================================== -->
  -  <target name="run-tests" depends="prepare" if="junit.present"
  -            description="--> runs all available testcases">
  -        
  -    <junit printsummary="no" haltonfailure="yes">
  -      <classpath>
  -        <pathelement location="${build.dest}"/>
  -        <path refid="classpath"/>
  -        <pathelement path="${classpath}"/>
  -      </classpath>
   
  -      <formatter type="plain" usefile="false"/>
  -
  -      <batchtest>
  -        <fileset dir="${build.src}">
  -          <include name="**/*Test.java"/>
  +  <target 
  +    name="test" 
  +    depends="compile"
  +    description="runs (junit) unit tests">
  +    
  +    <echo>
  +      Running all JUnit tests
  +    </echo>
  +    
  +    <delete dir="${test.reportsDirectory}"/>
  +    <mkdir dir="${test.reportsDirectory}"/>
  +    
  +    <junit printSummary="yes">
  +      <formatter type="plain"/>
  +      <classpath refid="classpath"/>
  +      <batchtest todir="${test.reportsDirectory}">
  +        <fileset dir="${build.dest}">
  +          <include name="**/*Test*.class"/>
  +          <exclude name="**/BaseTestCase.class"/>
           </fileset>
         </batchtest>
       </junit>
     </target>
   
     <!-- ================================================================== -->
  -  <!-- Run an single testcase                                             -->
  +  <!-- C O M P I L E  T E S T S                                           -->
     <!-- ================================================================== -->
  -  
  -  <target name="run-singletest" if="testcase">
  -  
  -    <junit printsummary="no" haltonfailure="yes">
  +
  +  <target
  +    name="compile"
  +    description="==> compiles the test source code">
  +    
  +    <ant antfile="build.xml" target="compile"/>
  +    
  +    <javac srcdir="${test.dir}"
  +      destdir="${build.dest}"
  +      excludes="**/package.html"
  +      debug="${debug}"
  +      deprecation="${deprecation}"
  +      optimize="${optimize}">
  +      <classpath refid="classpath"/>
         <classpath>
  -        <pathelement location="${build.dest}"/>
  -        <path refid="classpath" />
  -        <pathelement path="${classpath}"/>
  +        <pathelement path="${build.dest}"/>
         </classpath>
  -
  -      <formatter type="plain" usefile="false"/>
  -
  -      <test name="${testcase}"/>
  -    </junit>
  +    </javac>
     </target>
   
   </project>
  
  
  
  1.11      +1 -0      jakarta-turbine-3/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/build.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build.xml	21 Sep 2001 18:07:22 -0000	1.10
  +++ build.xml	31 Dec 2001 15:37:51 -0000	1.11
  @@ -34,6 +34,7 @@
       <pathelement location="${xerces.jar}"/>
       <pathelement location="${commons-collections.jar}"/>
       <pathelement location="${commons-util.jar}"/>
  +    <pathelement location="${stratum.jar}"/>
     </path>
   
     <!-- ================================================================== -->
  
  
  
  1.5       +9 -0      jakarta-turbine-3/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/default.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- default.properties	24 Dec 2001 16:04:51 -0000	1.4
  +++ default.properties	31 Dec 2001 15:37:51 -0000	1.5
  @@ -11,6 +11,7 @@
   project = turbine
   package = org.apache.${project}
   build.dir = ./bin
  +build.dest = ${build.dir}/classes
   src.dir = ./src
   conf.dir = ./conf
   javadoc.destdir = ./docs/apidocs
  @@ -24,6 +25,9 @@
   deprecation = off
   adapterCode = true
   
  +test.dir = ${src.dir}/test
  +test.reportsDirectory = test-reports
  +
   # Please see the BUILDING.txt file for information
   # on the locations of where to find each of these 
   # jar files
  @@ -39,4 +43,9 @@
   commons-collections.jar = ${lib.repo}/commons-collections.jar
   commons-util.jar = ${lib.repo}/commons-util-0.1-dev.jar
   
  +stratum.jar = ${lib.repo}/stratum.jar
  +dom4j.jar = ${lib.repo}/dom4j.jar
  +commons-beanutils.jar = ${lib.repo}/commons-beanutils.jar
  +
  +# Testing
   junit.jar = ${lib.repo}/junit-3.7.jar
  
  
  
  1.2       +3 -2      jakarta-turbine-3/src/test/org/apache/turbine/BaseTestCase.java
  
  Index: BaseTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-3/src/test/org/apache/turbine/BaseTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseTestCase.java	16 Aug 2001 04:41:48 -0000	1.1
  +++ BaseTestCase.java	31 Dec 2001 15:37:51 -0000	1.2
  @@ -61,9 +61,10 @@
    * case implementations are used to automate testing via JUnit.
    *
    * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
  - * @version $Id: BaseTestCase.java,v 1.1 2001/08/16 04:41:48 jvanzyl Exp $
  + * @version $Id: BaseTestCase.java,v 1.2 2001/12/31 15:37:51 jvanzyl Exp $
    */
  -public abstract class BaseTestCase extends TestCase
  +public abstract class BaseTestCase 
  +    extends TestCase
   {
       /**
        * Creates a new instance.
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>