我们如何使用JUnit测试不偏食

问题描述 投票:0回答:2

我已经写了JUnit中的一段代码。我需要不使用Eclipse运行它。任何建议,我该怎么办呢?

eclipse junit
2个回答
0
投票

由于Eclipse 2018-09在Java应用程序和JUnit启动配置有一个按钮带命令行为。

参见:video that shows this feature in action


0
投票

是的,你必须在命令行运行测试用例的选择,

例:

当你正在运行的MVN干净安装构建应用程序,以同样的方式,您还可以通过使用命令运行测试案件。

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
© www.soinside.com 2019 - 2024. All rights reserved.