junit测试套件

编程入门 行业动态 更新时间:2024-10-14 10:45:46
本文介绍了junit测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个脚本(test.bat),该脚本允许我通过命令行启动一个Java测试: -java -cp()org.junit.runner.JUnitCore包.Class

I have a script(test.bat) that allows me to launch one java test by command line : -java -cp() org.junit.runner.JUnitCore package.Class

现在我想对几个Java测试做同样的事情吗? 我该怎么办?我是否必须为每个Java测试添加字节码? 请给我一个例子吗?

Now I want to do the same for several java tests ? how could I do it? should I have to add the byte code for each java test? could I have an example , please?

推荐答案

您可以使用Ant使用junit ant任务通过单个命令运行测试.这是一个有关如何使用它的示例:

You can use Ant to run your tests with a single command with the junit ant task. Here's an example on how to use it:

<target name="runtests" depends="clean,compiletests"> <junit printsummary="yes" haltonfailure="no"> <classpath> <path refid="test.classpath" /> <pathelement location="${test.classes}"/> </classpath> <formatter type="xml"/> <batchtest fork="yes" todir="${test.reports}"> <fileset dir="${test.src}"> <include name="**/*Test*.java"/> </fileset> </batchtest> </junit> </target>

该目标使用batchtest,这是junit ant任务的一部分.它设置了您的测试类路径,因此将包括所有在类名中包含 Test .java模式的测试.查看 JUnit任务文档.

That target uses batchtest which is part of the junit ant task. It sets your test classpath so all your tests that contain the Test.java pattern in their class name will be included. Check out the JUnit Task documentation.

更多推荐

junit测试套件

本文发布于:2023-11-17 02:46:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608526.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:套件   测试   junit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!