Mavenmavenmaven

maven test 运行特定单元测试类的方法

2019-02-28  本文已影响9人  RJ_Hwang

1. 运行特定的测试类:

mvn test -D test=$ClassName

$ClassName 为要运行的测试类的类名(不要带扩展名),多个测试类间用英文逗号连接即可,类名支持 * 通配符,范例:

2. 运行测试类中指定的方法:

mvn test -D test=$ClassName#$MethodName

$MethodName 为要运行的单元测试方法的名称,与类名之间用 # 分隔开,支持 * 通配符,范例:

需要 maven-surefire-plugin:2.7.3 以上版本才支持

上一篇 下一篇

猜你喜欢

热点阅读