使用ant 执行Junit测试的问题

hellopower 2012-05-14 01:42:04
使用ant 执行Junit测试的问题, build.xml如下:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="test" name="Test TestSmokeTestForServer">
<import file="../BinaryRepositoryWS/build.xml"/>
<property name="TESTDIR" value="."/>
<property name="TEST-DEBUG" value="${TESTDIR}/ant-bin-debug"/>
<property name="REPORTS-DIR" location="reports"/>
<property name="LIB" value="lib" />
<property name="SRC" value="src"/>
<property name="JAVA_COMPILER_VERSION" value="1.6"/>
<property name="DEBUG" value="false" />
<property name="BUILD-DIR" value="ant-bin"/>
<target name="test" depends="compile-test, run-test" />
<target name="compile-test" depends="clean, mkdirs, compile"/>
<target name="compile" depends="mkdirs">
<javac target="${JAVA_COMPILER_VERSION}" srcdir="${SRC}" destdir="${BUILD-DIR}" debug="${DEBUG}">
<classpath refid="webservice-classpath"/>
<classpath refid="webservice-test-classpath"/>
<classpath location="${BUILD-DIR}"/>
</javac>
</target>
<target name="clean">
<delete dir="${TEST-DEBUG}" />
<delete dir="${REPORTS-DIR}" />
<delete dir="${BUILD-DIR}"/>
</target>
<target name="mkdirs">
<mkdir dir="${TEST-DEBUG}"/>
<mkdir dir="${REPORTS-DIR}"/>
<mkdir dir="${BUILD-DIR}"/>
</target>
<target name="run-test" depends="">
<junit fork="yes" forkmode="perTest" printsummary="yes" haltonfailure="no" haltonerror="false" showoutput="true" >
<classpath location="${TEST-DEBUG}"/>
<classpath location="${BUILD-DIR}"/>
<classpath location="${LIB}"/>
<formatter type="xml" />
<test name= "com.sonyericsson.binaryreposystem.client.TestSmokeTestForServer" />
</junit>
</target>
</project>


执行报错,build.xml:32: The <classpath> for <junit> must include junit.jar if not in Ant's own classpath
但是我已经下载了junit.jar 放到lib目录下了阿,
大家看看是什么问题呢。
谢谢!
...全文
303 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xdfwqwz 2013-01-29
  • 打赏
  • 举报
回复
请问楼主是怎么解决的???
hellopower 2012-05-14
  • 打赏
  • 举报
回复
classpath的问题,以及 解决了,再问个问题哈,使用ant执行某个测试的时候,可以传一些参数 覆盖测试的一些参数。
FFF9527 2012-05-14
  • 打赏
  • 举报
回复
试试将junit.jar拷贝到BUILD-DIR下面。实话我也不太懂...

62,634

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧