2013-02-11 114 views
0

它不會在螞蟻工作, 我想運行一些類,擴展DatabaseTestCase如何在ant中運行dbunit任務?

<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[] 

回答

0

我認爲這個問題是您的taskdef,它的缺少包含dbunit jar的路徑:

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