【发布时间】:2019-03-20 01:53:49
【问题描述】:
如何获取具有特定标签的所有场景的列表。例如 获取所有具有@checkout 标签的场景。
【问题讨论】:
-
你想执行所有带有@checkout标签的场景还是你想列出他们的名字,请详细说明。
-
我想列出他们的名字。我可以选择完整的日志和搜索,但这很麻烦。
标签: cucumber scenarios feature-file
如何获取具有特定标签的所有场景的列表。例如 获取所有具有@checkout 标签的场景。
【问题讨论】:
标签: cucumber scenarios feature-file
假设您有 15 到 20 个场景/场景大纲标记有 @checkout。
@checkout
Scenario Outline: Validation of UseCase Guest User Order Placement flow from Search
Given User is on Brand Home Page <Site>
And User searches for a styleId and makes product selection on the basis of given color and size
| Style_ID | Product_Size | Product_Color |
| TestData1 | TestData1 | TestData1 |
| TestData2 | TestData2 | TestData2 |
Then Clicking on Cart icon shall take user to Shopping Bag
请按此方式获取场景名称。
文件名 Hook.java
@Before
public void setUpScenario(Scenario scenario){
String scenarioName = scenario.getName();
//Either you can write down name of the scenario under a file system like excel or implement in the way you want
}
如果您觉得它有意义并且解决了您的问题,请告诉我们。
【讨论】:
试运行救援。
试运行让您无需实际运行即可快速扫描功能。
尝试以下 CucumberOptions 注释(这是 Java/Junit 版本,但该想法适用于任何地方)
@RunWith(Cucumber.class)
@CucumberOptions(plugin = { "pretty", "html:target/cucumber-html-report", "json:target/cucumber.json" }, glue = {
"some.stepdef" }, features = { "src/cucumberTest/featureFiles" }, tags = { "@now" }
,dryRun = true, strict=true)
public class CucumberNowTestDryRunner {
}
【讨论】: