获取具有特定标记的所有黄瓜方案

问题描述 投票:0回答:2

如何获取具有特定标记的所有方案的列表。例如,获取具有@checkout标记的所有方案。

cucumber scenarios feature-file
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
        }

请让我们知道您是否觉得它有意义并解决了您的问题。


0
投票

干跑去救援。

Dry run为您提供了一种快速扫描功能而无需实际运行它们的方法。

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

黄瓜报告看起来像这个enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.