简体   繁体   English

我的场景大纲似乎没有以我以前见过的格式输出

[英]My Scenario Outline doesn't seem to output in format I've seen before

I've decided to start refreshing my memory on how cucumber works. 我决定开始刷新黄瓜的工作方式。 And today I've come across something that doesn't really look farmiliar. 今天我遇到了一些看起来并不熟悉的东西。 I'm using a data table to make the test scalable. 我正在使用数据表来使测试可扩展。 When I generate the output from the scenario it seems to produce loads or arguments? 当我从场景生成输出时,它似乎产生了加载或参数? Why? 为什么? What am I doing wrong? 我究竟做错了什么?

I've tried adding strings to my step definitions. 我已经尝试在我的步骤定义中添加字符串。

@Given("^I navigate to cover checker site$")
public void i_navigate_to_cover_checker_site() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I add the registration number and search$")
public void i_add_the_registration_number_and_search(String registration) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I will be presented cover start and cover end (\\d+) FEB (\\d+) : (\\d+) : (\\d+) dates$")
public void i_will_be_presented_cover_start_and_cover_end_dates(String coverStart, String CoverEnd) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

} }

So here is my scenario: 所以这是我的场景:

Feature: Covercheck


      Scenario Outline: : Registration number check
        Given I navigate to cover checker site
        When I add the registration number <Registration> and search
        Then I will be presented cover start <CoverStart> and cover end <CoverEnd> dates

        Examples:
          | Registration | CoverStart            | CoverEnd              |
          | OV12UYY      | 09 FEB 2022 : 16 : 26 | 18 FEB 2022 : 23 : 59 |

THe output: 输出:

@Given("^I navigate to cover checker site$")
public void i_navigate_to_cover_checker_site() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I add the registration number OV(\\d+)UYY and search$")
public void i_add_the_registration_number_OV_UYY_and_search(int arg1) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I will be presented cover start (\\d+) FEB (\\d+) : (\\d+) : (\\d+)$")
public void i_will_be_presented_cover_start_FEB(int arg1, int arg2, int arg3, int arg4) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^cover end (\\d+) FEB (\\d+) : (\\d+) : (\\d+) dates$")
public void cover_end_FEB_dates(int arg1, int arg2, int arg3, int arg4) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

From what I remember you'd put the strings into your definitions your data in the feature files scenario outline. 根据我的记忆,您可以在特征文件场景大纲中将字符串放入定义中。

You are not implementing steps correctly in your feature file under Scenario Outline.You have Registration,CoverStart & CoverEnd under examples which shall be closed between <> in your respective steps in feature file like - When I add the number, similarly others 2.I give you one example. 您没有在Scenario Outline下的功能文件中正确实现步骤。您可以在功能文件中的各个步骤中的<>之间关闭注册,CoverStart和CoverEnd,例如 - 当我添加数字时,类似其他2.I举个例子。

Please have a look for better understanding of how to implement Example & Data Table. 请查看如何更好地理解如何实现示例和数据表。

  @BAMS_Submitted_State_Guest_User
  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
    Then Clicking on Proceed To Checkout button shall take user to Shipping Page
    And Submitting FN as <FName> LN as <LName> Add as <AddL1> ZCode as <ZipCode> PNo as <PhoneNo> EmailID as <EmailID> shall take user to payment page
    And Submitting CCardNo as <CCNo> Month as <CCMonth> Year as <CCYear> and CVV as <CVV> shall take user to Order Review Page
    And Click on the place order button
    Then Verify order gets placed successfully and capture the Order ID in excel as CellNo as <CellNo>
Examples: Checkout User Information
  | Site  | EmailID   | FName     | LName     | AddL1     | ZipCode   | PhoneNo   | CCNo      | CCMonth   | CCYear    | CVV       | CellNo    |
  | Site1 | TestData3 | TestData2 | TestData2 | TestData2 | TestData2 | TestData2 | TestData1 | TestData1 | TestData1 | TestData1 | TestData1 |

If you want to match as Strings, try the following: 如果要匹配为字符串,请尝试以下操作:


@Given("^I navigate to cover checker site$")
public void i_navigate_to_cover_checker_site() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I add the registration number (.*) and search$")
public void i_add_the_registration_number_and_search(String registration) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I will be presented cover start (.*) and cover end (.*) dates$")
public void i_will_be_presented_cover_start_and_cover_end_dates(String coverStart, String CoverEnd) throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

The (.*) will match the Strings; (.*)将匹配字符串; make sure to put them in the right place in your step & step definition though. 确保将它们放在步骤和步骤定义中的正确位置。 You'll have to convert the Strings to Dates yourself in the step definition. 您必须在步骤定义中自己将字符串转换为日期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM