我们如何在没有日食的情况下使用Junit测试 [英] How can we use Junit test without eclipse

查看:75
本文介绍了我们如何在没有日食的情况下使用Junit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Junit中编写了一段代码.我需要运行它而不会蚀.有什么建议我该怎么做?

I have wrote a piece of code in Junit. I need to run it without eclipse. Any suggestions how can I do that ?

推荐答案

是的,您可以选择在命令行中运行测试用例

Yes, you have an option to run your test cases in command line,

示例:

在运行用于构建应用程序的mvn全新安装时, 同样,您也可以使用命令来运行测试用例.

As you are running the mvn clean install for building your application, In the same way, you can also run your test cases as well by using the command.

1. Command to compile your test class >> **javac -cp junit-4.12.jar;. UserDAOTest.java ProductDAOTest.java** --> general command is >> **javac -cp <junit-jar-file>;. TestClass1.java TestClass2.java**
2. Run the test cases >> ** java -cp <junit-jar>;<hamcrest-jar>;. org.junit.runner.JUnitCore  TestClass1 TestClass2 **
3. Running the unit test cases by Maven Command Line >> mvn test >> mvn clean test >> mvn clean compile test

这篇关于我们如何在没有日食的情况下使用Junit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆