[英]how to integrate junit in gwt project with the ant build file
我有一個gwt項目,並且我想在我的項目中進行單元測試,因此我在ant構建文件中添加了junit目標。 但是構建總是失敗的
失敗的C:\\ SG \\ workspace \\ app \\ build.xml:78:如果不在Ant自己的類路徑中,則for必須包含junit.jar
這是腳本
<target name="test" depends="clean.test,gwtc" description="run all Junit tests">
<mkdir dir ="test/test"/>
**<junit fork = "false" printsummary = "yes"/>** <!-- the line 78-->
<classpath refid = "project.class.path"/>
<batchtest todir = "test/test">
<fileset dir = "test" includes="**/${test}Test.java"/>
</batchtest>
<formatter type = "xml"/>
<junitreport toDir = "test/test">
<fileset dir = "test/test"/>
<report format="frames" todir="test"/>
</junitreport>
<exec os="window" executable="cmd.exe">
<arg line="-a /Applications/Safari.app test/index.html"/>
</exec>
</target>
您太早關閉了<junit />
標記。
這是對的。 classpath
, batchtest
和formatter
必須在junit
標簽內:
<junit fork = "false" printsummary = "yes">
<classpath refid = "project.class.path"/>
<batchtest todir = "test/test">
<fileset dir = "test" includes="**/${test}Test.java"/>
</batchtest>
<formatter type = "xml"/>
</junit>
而且,您必須確保junit.jar
位於ANT_HOME / lib中,在project.class.path中引用,或者作為另一個類路徑添加,例如<classpath refid = "junit.class.path"/>
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.