无法从命令行覆盖黄瓜选项中的黄瓜标签

时间:2020-12-29 12:01:52

标签: java selenium junit cucumber

我有一个奇怪的问题,我无法使用我从命令行提供的标签覆盖跑步者中的标签。

跑步者类:-

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty",
                "timeline:target/cucumber-timeline/",
                "json:target/cucumber-report/cucumber.json",
                "junit:target/cucumber-report/report-xml.xml"},
        dryRun = false,
        useFileNameCompatibleName = true,
        stepNotifications = true,
        strict = true,
        features = "src/test/resources/features",
        snippets = CucumberOptions.SnippetType.CAMELCASE,
        glue = {"com.Novatel"},
        tags = {"@smoke"})
public class RunCucumberIT {
}

示例特征文件:-

@sampleTest
Feature: Testing the website navigation

  Scenario: Navigate to the the site1
    Given I click on the URL
    Then I navigate to the site

 @smoke
  Scenario: Navigate to bbc1
    Given I navigate to the url
    Then I am able to view the news

我设置了以下 sys 属性并运行:-

mvn clean verify -DCucumber.filter.tags="@sampleTest"

但它只是忽略了上面的标签来运行该功能并使用@smoke 标签运行第二个场景,但这不是我想要的,因为我需要从命令行运行带有自己的标签的功能。我知道这是可能的,但我不知道为什么它不起作用。我用谷歌搜索了几个小时都没有运气。我使用 Cucumber 5.0.0 和 Junit 4.12。

任何帮助将不胜感激。 谢谢

0 个答案:

没有答案