您必须
formatter在
junit任务内使用一个元素。格式化程序默认情况下将创建一个报告文件,但是您可以强制其在屏幕上打印结果。您可以使用两种格式化程序:一种用于输出到屏幕,另一种用于输出到文件。
请注意,您不再需要的属性
printsummary="yes",并
showoutput="true"在junit任务。格式化程序现在正在处理输出。
<project name = "TestPrj" default="unittest" basedir = "."><target name="unittest" > <junit> <classpath> <pathelement location="./junit-4.8.2.jar"/> <pathelement location="./ant-junit4.jar"/> </classpath> <formatter type="plain" usefile="false" /> <!-- to screen --> <formatter type="plain" /> <!-- to file --> <test name = "com.mytest.unittest.SimpleTest" todir="."/> </junit></target></project>
阅读ant手册中的junit页面以获取更多信息。



