T E S T S

Running com.howtodoinjava.junit.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 sec
Running com.howtodoinjava.junit.TestSurefire
Another testcase executed
First testcase executed
Third testcase executed
Second testcase executed
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 sec

Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0


2)仅使用“`-Dtest=TestSurefire test`”执行特定的测试类:这将执行测试类`TestSurefire`中的所有测试用例。

```java
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.howtodoinjava.junit.TestSurefire
Another testcase executed
First testcase executed
Third testcase executed
Second testcase executed
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.033 sec

Results :

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

您可以在命令中使用多个测试类,甚至可以在测试类名称中使用通配符来匹配一组测试类。 例如mvn -Dtest=TestSurefire,TestOth*Class test

3)仅使用“mvn -Dtest=TestSurefire#testcaseFirst test”在测试类中测试某个测试用例:此命令将仅执行单个测试用例方法,即testcaseFirst()

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.howtodoinjava.junit.TestSurefire
First testcase executed
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.034 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

4)使用通配符映射测试多个测试用例,例如 “mvn -Dtest=TestSurefire#testcase* test”:这将有助于在一个简单的短命令中运行多个具有相似名称的测试用例。

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.howtodoinjava.junit.TestSurefire
First testcase executed
Second testcase executed
Third testcase executed
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.034 sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

给我留言不清楚,或者我缺少的东西。