建立工程: 在eclipse中建立一个java project.AntTest -src -com.test -ABS.java -ABSTest.java (Junit Test Case) -lib -build.xml -JUNIT_HOME/junit.jar配置:eclipse->window->preference->ANT->Runtime->Classpath->ANT Home Entry选择Add External JAR,加入ECLIPSE_HOME/plugins/org.junit.../junit.jar
build.xml的内容:
运行: 右键build.xml->run as "Ant Build".
结果: 控制台有输出结果,例如:Buildfile: C:\Documents and Settings\qianwang\My Documents\D\SMPWorkspace\AntTest\build.xmlcompile:junit: [mkdir] Created dir: C:\Documents and Settings\qianwang\My Documents\D\SMPWorkspace\AntTest\report\framework-20070201-1712 [junit] Running com.test.ABSTest [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0 secBUILD SUCCESSFULTotal time: 19 seconds
同时,AntTest/report(如果没有自动建立的目录)中,产生.txt格式的文本文件.结果文件中,会指出运行了哪些testcase(指出被测试的方法名test**).如果有failures/errors,异常的详细信息也会输出在这里.
posted on 2007-02-08 21:17 cerulean 阅读(2511) 评论(0) 编辑 收藏 所属分类: eclipse 、Ant