我想知道是否有辦法在 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
提交
取消