如何在ant中运行dbunit任务?

时间:2013-02-11 17:05:52

标签: ant junit dbunit

它不适用于蚂蚁, 我想运行一些扩展DatabaseTestCase的类

<path id="libs.dir">
                <fileset dir="lib" includes="**/*.jar" />
</path>
<taskdef name="dbunit" 
         classname="org.dbunit.ant.DbUnitTask"/>


<!-- run all tests in the source tree -->
<junit printsummary="yes" haltonfailure="yes">
  <formatter type="xml"/>
  <batchtest fork="yes" todir="${reports.tests}">
    <fileset dir="${src.tests}">
      <include name="**/*Test*.java"/>
    </fileset>
  </batchtest>
</junit>

它说:

Buildfile: D:\kariakin\jdbc_task\build.xml

BUILD FAILED
D:\kariakin\jdbc_task\build.xml:15: taskdef class org.dbunit.ant.DbUnitTask cannot be found
 using the classloader AntClassLoader[]

1 个答案:

答案 0 :(得分:0)

我认为问题是你的taskdef,它缺少包含dbunit jar的路径:

<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="libs.dir"/>