根据标签运行黄瓜测试



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

@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运行测试用例,但前提是它没有任何其他标签

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

最新更新