Author: skitching
Date: Tue Jul  5 02:52:57 2005
New Revision: 209252

URL: http://svn.apache.org/viewcvs?rev=209252&view=rev
Log:
Update the test.pathable target. Note that the optional ant junit task is
now used in this file - see comments at head of file for details.

Modified:
    jakarta/commons/proper/logging/trunk/build.xml

Modified: jakarta/commons/proper/logging/trunk/build.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/build.xml?rev=209252&r1=209251&r2=209252&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/build.xml (original)
+++ jakarta/commons/proper/logging/trunk/build.xml Tue Jul  5 02:52:57 2005
@@ -16,13 +16,22 @@
 
 -->
 
-<project name="Logging" default="compile" basedir=".">
-
-
 <!--
-        "Logging" component of the Jakarta Commons Subproject
-        $Id$
--->
+  - Ant build file for commons-logging.
+  -
+  - Note that this build file uses the optional <junit> task. While the
+  - task "adapter" class comes by default with ant 1.6+, the junit libraries
+  - (3.8.1 or later) are also required to be made available to ant. This
+  - requires that you do one of the following:
+  -  * create directory ~/.ant/lib and place the junit jar there
+  -  * put the junit jar in $ANT_HOME/lib
+  -  * run ant as "ant -lib path-to-junit-jar"
+  -  * put the junit jar in $CLASSPATH
+  -
+  - $Id$
+  -->
+
+<project name="Logging" default="compile" basedir=".">
 
 
 <!-- ========== Initialize Properties ===================================== -->
@@ -582,15 +591,65 @@
   </target>
 
 
+  <!--
+    - Target to run all unit tests under the "pathable" directory.
+    -
+    - The batchtest task auto-detects what tests are available without
+    - any need to define TestSuite objects in the code to compose
+    - sets of tests to be run.
+    -
+    - Details of the unit test results for each TestCase will appear in
+    - a file in directory ${build.home}/test-reports, together with any
+    - output to stdout or stderr generated by the test code.
+    -
+    - If you're having problems running this target due to the use of
+    - the "junit" task below, see the comments at the head of this file.
+    - 
+    - TODO: implement something like the "testmatchpattern" feature
+    - of maven's test task. This would allow people to do something like
+    -   ant -Dtestmatchpattern=**/FooTestCase.java test.pathable
+    - in order to run specific test cases, or subsets of test cases.
+    -->
   <target name="test.pathable" depends="compile.tests"
    description="Run unit tests specific to Pathable support classes">
+    <echo message="Test output can be found in directory 
${build.home}/test-reports."/>
+    <delete dir="${build.home}/test-reports"/>
+    <mkdir dir="${build.home}/test-reports"/>
 
-    <echo message="Pathable tests..."/>
-    <java classname="${test.runner}" fork="yes" 
failonerror="${test.failonerror}">
-      <arg value="org.apache.commons.logging.pathable.PathableTestCase"/>
-      <classpath refid="test.classpath.jdk14"/>
+    <!--
+      - Note that the fork/forkmode settings define default behaviour for 
tests. 
+      - The <test> and <batchtest> tags can override these settings if needed.
+      - The default settings cause a single VM to be created in which all of
+      - the tests are then run. 
+      -->
+    <junit printsummary="off" showoutput="no" fork="yes" forkmode="once">
+      <!-- plain output to file; brief output to console. -->
+      <formatter type="plain"/>
+      <formatter usefile="false" type="brief"/>
+
+      <!-- 
+        - Provide a set of properties pointing to the logging libs for
+        - the use of the PathableClassLoader class used by some unit tests.
+       -->
       <syspropertyset refid="test-lib-props"/>
-    </java>
+      <classpath>
+        <pathelement location="${build.home}/tests"/>
+        <pathelement location="${junit.jar}"/>
+      </classpath>
+
+      <!--
+        - Auto-detect the tests to run. Checking the source directory
+       - for java files rather than the ${build.home}/tests directory
+       - for .class files is deliberate; that will pick up any problems
+       - where we haven't correctly compiled all the available unit test
+       - source files.
+       -->
+      <batchtest todir="${build.home}/test-reports">
+        <fileset dir="${test.home}">
+          <include name="**/pathable/*TestCase.java"/>
+        </fileset>
+      </batchtest>
+    </junit>
   </target>
 
   <target name="test.jdk14" depends="compile.tests" if="jdk.1.4.present"



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to