我有以下黄瓜特征:
Feature: Myfeature
@tag1
Scenario: 1st scenario
Given
When
Then
@tag2
Scenario: 2nd scenario
Given
When
Then
我只想运行 Myfeature 文件中的标记场景 @tag1,而忽略其他功能文件中的 @tag1
我尝试了以下命令,但没有按预期工作
mvn verify -P nrt -Denv=Dev
-Dcucumber.options="src/test/resources/scenarios/MyFeature.feature --tags @tag1"
答案 0 :(得分:0)
cucumber.options
属性已弃用并删除。您必须将每个选项作为单个属性传递。
mvn test -Dcucumber.filter.tags='@smoke and not @ignore' -Dcucumber.features=path/to.feature
答案 1 :(得分:0)
也许可以尝试简单的解决方法,然后再添加一个独一无二的标签,例如 @tag1Myfeature
答案 2 :(得分:0)
尝试在 CucumberRunner Options -> 标签中使用“AND”条件 tags = {“@Feature”, “@tag1”} :表示 AND 条件。 – 它表示需要执行匹配这两个标签的场景。