0

如何获取具有特定标签的所有场景的列表。例如获取所有具有@checkout 标签的场景。

4

2 回答 2

0

让我们假设你有 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
        }

如果您觉得它有意义并且解决了您的问题,请告诉我们。

于 2019-03-20T16:38:54.903 回答
0

干跑救援。

试运行为您提供了一种无需实际运行即可快速扫描功能的方法。

尝试以下 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 {
}

黄瓜报告将如下所示 在此处输入图像描述

于 2019-03-21T21:46:40.653 回答