根据标签运行黄瓜测试

问题描述 投票:0回答:1

我正在尝试根据测试用例的标签运行一些黄瓜测试。

@CucumberOptions(
        features = {"src/test/resources/features"},
        glue = {"<glue value>"},
        plugin = {"pretty", "json:target/cucumber-json-reports/monitor-cucumber-report.json"},
        tags =
                {
                        "@monitor",
                        "not @_ignore",
                        "not @under_construction"
                }
)
public class MonitorCucumberTests extends AbstractTestNGCucumberTests {}

其他文件:

@CucumberOptions(
        features = {"src/test/resources/features"},
        glue = {"<glue value>"},
        plugin = {"pretty", "json:target/cucumber-json-reports/monitor-cucumber-report.json"},
        tags =
                {
                        "@monitor",
                        "not @_ignore",
                        "not @under_construction",
                        "not @<none_monitor_feature>"
                }
)
public class MonitorCucumberTests2 extends AbstractTestNGCucumberTests {}

功能文件:

@monitor @verification @hourly
Feature: Verification flow

  Scenario Outline: Verification happy flow
    Given stuff
    When do stuff


@monitor @verification @hourly @<none_monitor_feature>
Feature: Verification flow with extra

  Scenario Outline: Verification happy flow with extras
    Given stuff
    When do stuff with extra

如果我使用MonitorCucumberTests运行,它将按预期运行两个测试用例。如果我使用MonitorCucumberTests2运行,它仍将同时运行两个测试用例。

我不知道如何使用@monitor来运行测试用例,但前提是它没有任何其他标签

tags automated-tests cucumber logic cucumber-java
1个回答
0
投票

问题是我确实设置了一个变量,所以我使用MonitorCucumberTests2来运行。

© www.soinside.com 2019 - 2024. All rights reserved.