我想知道是否有办法在 Cucumber 运行时修改 CucumberOptions 标签?我不确定这是否可行,但我想知道是否有办法在 Cucumber 运行时修改标签。在我的示例代码中,我想在 Cucumber 运行后添加另一个标记“@Login”。我正在尝试设置一个配置,在其中我可以选择要运行的功能而无需进入 Runner 类。设置类 String AddTags = "@Login"; set = new HashMap<String, String>(){ {put("Tags", AddTags);赛跑者import org.junit.runner.RunWith;import cucumber.api.CucumberOptions;import cucumber.api.junit.Cucumber;@RunWith(Cucumber.class) @CucumberOptions (features="src/test/cucumber/features", tags = "@Smoke", //For instance, once cucumber runs I want to add tag "@Login". //So something like adding Settings.set.get("Tags");plugin = {"pretty", "html:target/cucumber- htmlreport","json:target/cucumber-report.json"})public class Runner {}不确定 Cucumber 是否可行,但想问一下。
2 回答
FFIVE
TA贡献1797条经验 获得超6个赞
您可以使用标签表达式来组合多个标签,例如:
**Expression Description**
@fast Scenarios tagged with @fast
@wip and not @slow Scenarios tagged with @wip that aren’t also tagged with @slow
@smoke and @fast Scenarios tagged with both @smoke and @fast
@gui or @database Scenarios tagged with either @gui or @database
添加回答
举报
0/150
提交
取消