Dcucumber.options,如何拥有多个标签
Dcucumber.options, how to have multiple tags
我正在尝试 运行 使用 maven 和以下命令进行黄瓜测试
mvn test -Dcucumber.options="--tag @debug1"
这个命令工作正常,但是如果我尝试类似下面的操作,我会得到错误
mvn test -Dcucumber.options="--tag @debug1 @debug2"
有没有办法通过 cucumber 运行 时间选项传入多个标签名称?
- 运行 场景
@debug1
和 @debug2
:
旧版本Cucumber-jvm:
mvn test -Dcucumber.options="--tags @debug1 --tags @debug2"
Cucumber-jvm的实际版本:
mvn test -Dcucumber.options="--tags '@debug1 and @debug2'"
- 运行 场景
@debug1
或 @debug2
:
旧版本Cucumber-jvm:
mvn test -Dcucumber.options="--tags @debug1,@debug2"
Cucumber-jvm的实际版本:
mvn test -Dcucumber.options="--tags '@debug1 or @debug2'"
晚会有点晚了,但我正在使用类似的东西:
mvn test -D tags="debug1 and debug2"
我正在使用 Cucumber 2.4。
@
符号是可选的。您可以使用 tags
Maven 属性。您可以使用布尔逻辑来连接多个标签 - official docs.
减少了一点打字量。
我使用此命令行 运行 多个标签
mvn test -Dcucumber.options="--tags '@tag1 or @tag2' --plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm --plugin rerun:rerun/failed_scenarios.txt"
黄瓜版本 4.2.6
mvn clean verify -D tags="tagName"
在黄瓜v5.X中,只有mvn test -Dcucumber.options="--tags '@debug1 or @debug2'"
得到支持和工作。
mvn test -Dcucumber.options="--tags '@debug1 and @debug2'"
不工作,两种情况都不会执行
在 Cucumber 6 中,属性 名称已更改。使用:
mvn verify -Dcucumber.filter.tags="@debug1 or @debug2"
对我来说 surefire 插件:
mvn clean test -D"cucumber.filter.tags=@tag1 or @tag2"
当我尝试使用此版本时:
mvn clean test -Dcucumber.filter.tags="not @MyTag"
我遇到了这个异常:
io.cucumber.core.exception.CucumberException: Failed to parse 'cucumber.filter.tags' with value '"not @MyTag"'
Caused by: io.cucumber.tagexpressions.TagExpressionException: Tag expression '"not @MyTag"' could not be parsed because of syntax error: expected operator
对于版本 6.10.2 Cucumber 和 Junit 4.12
mvn test "-Dcucumber.filter.tags= (@Tag1 or @Tag2) and not @Tag3"
其中“或”等于“和”......无缘无故(感谢 Cucumber...)
对于黄瓜 6 使用:mvn clean test -D"cucumber.filter.tags=@smoke 或 @dev"
对于黄瓜 4 使用:mvn clean test -D"cucumber.options.tags=@smoke 或 @dev"
我正在尝试 运行 使用 maven 和以下命令进行黄瓜测试
mvn test -Dcucumber.options="--tag @debug1"
这个命令工作正常,但是如果我尝试类似下面的操作,我会得到错误
mvn test -Dcucumber.options="--tag @debug1 @debug2"
有没有办法通过 cucumber 运行 时间选项传入多个标签名称?
- 运行 场景
@debug1
和@debug2
:
旧版本Cucumber-jvm:
mvn test -Dcucumber.options="--tags @debug1 --tags @debug2"
Cucumber-jvm的实际版本:
mvn test -Dcucumber.options="--tags '@debug1 and @debug2'"
- 运行 场景
@debug1
或@debug2
:
旧版本Cucumber-jvm:
mvn test -Dcucumber.options="--tags @debug1,@debug2"
Cucumber-jvm的实际版本:
mvn test -Dcucumber.options="--tags '@debug1 or @debug2'"
晚会有点晚了,但我正在使用类似的东西:
mvn test -D tags="debug1 and debug2"
我正在使用 Cucumber 2.4。
@
符号是可选的。您可以使用 tags
Maven 属性。您可以使用布尔逻辑来连接多个标签 - official docs.
减少了一点打字量。
我使用此命令行 运行 多个标签
mvn test -Dcucumber.options="--tags '@tag1 or @tag2' --plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm --plugin rerun:rerun/failed_scenarios.txt"
黄瓜版本 4.2.6
mvn clean verify -D tags="tagName"
在黄瓜v5.X中,只有mvn test -Dcucumber.options="--tags '@debug1 or @debug2'"
得到支持和工作。
mvn test -Dcucumber.options="--tags '@debug1 and @debug2'"
不工作,两种情况都不会执行
在 Cucumber 6 中,属性 名称已更改。使用:
mvn verify -Dcucumber.filter.tags="@debug1 or @debug2"
对我来说 surefire 插件:
mvn clean test -D"cucumber.filter.tags=@tag1 or @tag2"
当我尝试使用此版本时:
mvn clean test -Dcucumber.filter.tags="not @MyTag"
我遇到了这个异常:
io.cucumber.core.exception.CucumberException: Failed to parse 'cucumber.filter.tags' with value '"not @MyTag"'
Caused by: io.cucumber.tagexpressions.TagExpressionException: Tag expression '"not @MyTag"' could not be parsed because of syntax error: expected operator
对于版本 6.10.2 Cucumber 和 Junit 4.12
mvn test "-Dcucumber.filter.tags= (@Tag1 or @Tag2) and not @Tag3"
其中“或”等于“和”......无缘无故(感谢 Cucumber...)
对于黄瓜 6 使用:mvn clean test -D"cucumber.filter.tags=@smoke 或 @dev"
对于黄瓜 4 使用:mvn clean test -D"cucumber.options.tags=@smoke 或 @dev"