lla*_*kin 7 junit maven maven-surefire-plugin
我使用Spring @IfProfileValue标志识别了许多测试
@IfProfileValue{"a", "c"}
@Test
public void testA{ Do Stuff }
@IfProfileValue{"a", "b"}
@Test
public void testB{ Do Stuff }
@IfProfileValue{"a", "b"}
@Test
public void testC{ Do Stuff }
@IfProfileValue{"b"}
@Test
public void testD{ Do Stuff }
Run Code Online (Sandbox Code Playgroud)
我可以使用运行所有测试
mvm clean install -Dtest-group=a -Dtest-group=b
Run Code Online (Sandbox Code Playgroud)
我想只运行匹配@IfProfileValue = {"a","b")的测试(测试B/C)所以有没有办法只使用maven运行这两个值的交集?
编辑:
您可以使用 ProfileValueSource` 注释该类,如本答案@ProfileValueSourceConfiguration@ and provide your own implementation of中所述。
看起来单独使用 Maven 是不可能的。看起来它可以从具有相同名称的多个参数构建数组:
mvn test -Dtest-group=a -Dtest-group=c
Run Code Online (Sandbox Code Playgroud)
将运行带有 注释的测试@IfProfileValue(name = "test-group", values = {"c"})。逗号符号都不起作用,它会将 'a,c' 视为文字:
mvn test -Dtest-group=a,c
Run Code Online (Sandbox Code Playgroud)
mvn test -Dtest-group=a -Dtest-group=c
Run Code Online (Sandbox Code Playgroud)
Java代码:
mvn test -Dtest-group=a,c
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
690 次 |
| 最近记录: |