是否可以在同一个空手道命令行上通过标签包含和排除
Is it possible to include and exclude via tags on the same karate command line
我们可以 select 通过在命令行中包含以下内容来实现多个场景:
-Dcucumber.options="--标签@S1,@S2,@S6"
如果我想排除@S6,我可以:
-Dcucumber.options="--标签 ~@S6"
但如果我想包含@S1、@S2 并排除@S6,则所有标签都将被忽略:
-Dcucumber.options="--标签@S1,@S2,~@S6"
如果我尝试通过以下方式加倍选项,所有标签也会被忽略:
-Dcucumber.options="--tags @S1,@S2" -Dcucumber.options="--tags ~@S6"
是否有一种命令行方式可以在一个命令行中包含和排除?
我想这样做的原因是 运行 所有类型的测试,但不包括使用某些可能暂时关闭的外部系统的测试。
编辑:原来我没有完全意识到 Cucumber 世界中 AND 和 OR 之间的区别。这个 and this article 是一个很好的参考,寻找“逻辑或”和“逻辑与”:
所以到运行S1OR
S2AND NOT
S3
mvn test -Dkarate.options="--tags @S1,@S2 --tags ~@S3"
使用 Java(或 Runner
)API,只需为 OR 使用逗号,为 AND 使用分隔字符串:
Results results = Runner.path("classpath:com/myco/some.feature")
.tags("@S1,@S2", "~@S3")
.parallel(5);
对于真正高级案例,另请参阅:
我们可以 select 通过在命令行中包含以下内容来实现多个场景: -Dcucumber.options="--标签@S1,@S2,@S6"
如果我想排除@S6,我可以: -Dcucumber.options="--标签 ~@S6"
但如果我想包含@S1、@S2 并排除@S6,则所有标签都将被忽略: -Dcucumber.options="--标签@S1,@S2,~@S6"
如果我尝试通过以下方式加倍选项,所有标签也会被忽略: -Dcucumber.options="--tags @S1,@S2" -Dcucumber.options="--tags ~@S6"
是否有一种命令行方式可以在一个命令行中包含和排除?
我想这样做的原因是 运行 所有类型的测试,但不包括使用某些可能暂时关闭的外部系统的测试。
编辑:原来我没有完全意识到 Cucumber 世界中 AND 和 OR 之间的区别。这个
所以到运行S1OR
S2AND NOT
S3
mvn test -Dkarate.options="--tags @S1,@S2 --tags ~@S3"
使用 Java(或 Runner
)API,只需为 OR 使用逗号,为 AND 使用分隔字符串:
Results results = Runner.path("classpath:com/myco/some.feature")
.tags("@S1,@S2", "~@S3")
.parallel(5);
对于真正高级案例,另请参阅: