Project

General

Profile

« Previous | Next » 

Revision 971

Added by Jing Tao over 22 years ago

Add a target - test in the file. Now user can type "ant test" to run the test class extends from JUnit.

View differences:

build.xml
129 129
      <filter token="eml-version" value="${eml-version}"/>
130 130

  
131 131
      <property name="srcdir" value="./src" />
132
      <property name="junittestsdir" value="./junittests" />
132 133
      <property name="build.dir" value="./build"/>
133 134
      <property name="build.src" value="${build.dir}/src"/>
134 135
      <property name="build.dest" value="${build.dir}/classes"/>
135 136
      <property name="build.docs" value="${build.dir}/docs"/>
136 137
      <property name="build.samples" value="${build.dir}/samples"/>
137 138
      <property name="build.tests" value="${build.dir}/tests"/>
139
      <property name="build.junittests" value="${build.dir}/junittests"/>
138 140
      <property name="build.data" value="${build.dir}/data"/>
139 141
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
140 142
      <property name="build.img" value="${installdir}/${image-path}"/>
......
257 259
             ***********************************************************
258 260
       </echo>
259 261
   </target> 
262
   
263
   <target name="test" depends="install">
264
      <!-- copy and compile the tests into a jar file -->
265
      <mkdir dir="${build.junittests}"/>
266
      <copy todir="${build.junittests}" filtering="yes">
267
        <fileset dir="${junittestsdir}">
268
          <exclude name="**/CVS*"/>
269
          <exclude name="**/.#*"/>
270
        </fileset>
271
      </copy>
272
      <javac srcdir="${build.junittests}"
273
             destdir="${build.dest}"
274
             classpath="${cpath}" />
260 275

  
276
      <jar jarfile="${build.dir}/${name}-junittests.jar" basedir="${build.dest}"
277
           includes="${package.home}/${name}junittests/**" />
278

  
279
      <!-- use the ant "junit" task to run JUnit tests. -->
280
      <junit printsummary="yes" haltonfailure="no" fork="no"
281
             haltonerror="no">
282
        <classpath>
283
          <pathelement path="${cpath}:${build.dir}/${name}-junittests.jar" />
284
        </classpath>
285

  
286
        <formatter type="plain" />
287

  
288
        <batchtest fork="yes" todir="${build.dir}">
289
          <fileset dir="${build.junittests}">
290
            <include name="**/*.java" />
291
          </fileset>
292
        </batchtest>
293
     </junit>
294
   </target>
295
   
261 296
   <target name="clean" depends="init">
262 297
       <delete dir="${build.dir}" />
263 298
   </target>

Also available in: Unified diff