📅  最后修改于: 2020-12-26 14:07:20             🧑  作者: Mango
此任务用于从JUnit测试框架运行测试。此任务取决于默认情况下未包含在Apache Ant分发中的外部库。
运行此任务都需要junit.jar和ant.junit.jar ,因此请将这些JAR放在ANT_HOME / lib位置。
在build.xml文件中使用
Attribute | Description | Required |
---|---|---|
printsummary | It prints summery of the test cases. | No |
fork | Run the tests in a separate JVM | No |
forkmode | It controls how many JVMs get created if we want to fork test cases. | No |
haltonerror | It stops the build process if any error occurs. | No |
errorproperty | This property is set in error event. | No |
haltonfailure | It stops the build process if a test fails. | No |
timeout | It cancels the individual tests if they don’t finish in the given time. | No |
maxmemory | Maximum amount of memory to allocate to the forked JVM. | No |
jvm | The command used to invoke JVM. | No |
dir | The directory in which to invoke JVM. | No |
tempdirA directory where Ant should place temporary files.No | reloadingWhether or not a new classloader should be instantiated for each test case.No | clonevmIt makes a clone of the process running in JVM.No |
让我们看一些示例,以了解此测试任务的功能。
上面的示例正在运行一个定义在TestCase中的测试用例。
本示例运行一个单独的JVM并对其进行测试。 fork属性将运行一个新的JVM。