×
☰ See All Chapters

Cucumber But

  • But keyword is used to exclude an input/context from the Given, exclude the action from When, exclude and outcome from Then. 

  • Exclude step from Given: 

Feature: Login

  Scenario: Successful Login to the page

    Given I open Chrome browser

    And I navigate to login page

    But I navigate to login page in a new tab

  • Exclude step from When: 

Feature: Login

  Scenario: Successful Login to the page

    Given I open Chrome browser

    And I navigate to login page

    But I navigate to login page in a new tab

    When I click on login option

    When I provide username as "manu.m@tools4testing.com" and password as "*****"

    But Username should be Email       

  • Exclude step from Then: 

Feature: Login

  Scenario: Successful Login to the page

    Given I open Chrome browser

    And I navigate to login page

    But I navigate to login page in a new tab

    When I click on login option

    When I provide username as "manu.m@tools4testing.com" and password as "*****"

    But Username should be Email

    When I click on login button

    Then Login success window should be displayed

    Then Login success window should welcome me

    But Login success window should be a pop up

 


All Chapters
Author