Does if else concept available in feature file (Gherkin language)?

后端 未结 4 1041
暖寄归人
暖寄归人 2021-01-18 21:32

Is there anyway where we can use if/else concept in feature file? For example:

  Scenario: User should be able to check login page
  Given I am on login pag         


        
4条回答
  •  醉梦人生
    2021-01-18 22:33

    Not that I am aware of. Gherkin (and cucumber) are best used when they specify discreet business cases though, and should be repeatable, else they get hard to follow and test. It looks like you have two stories here at least:

    Scenario: A new user should be asked to sign in
      Given I am a new user
      And I navigate to the login page
      When I click on SignIn button
      I should not be able to get to the home page
    
    Scenario: An existing user should be able to log in
      Given I am an existing user
      And I navigate to the login page
      And I submit valid credentials
      When I click on SignIn button
      I should be taken to the home page
    

提交回复
热议问题