Tagging the Hooks
What if we want to execute some piece of code only before certain Scenarios and not before all Scenarios? Consider a situation where we want to invoke the Selenium Webdriver for the Scenarios related to browser automation and the REST
Client code for Scenarios related to REST
Services automation. How do we do this in Cucumber? Let's see this in the next section.
Getting ready
For this recipe, we are going to use update home_page.feature
like this:
Feature: Home Page Background: flow till home page Given user is on Application home page @web Scenario: Home Page Default content on Web Then user gets a GitHub Bootcamp section @rest Scenario: GitHub account REST Service When user sends a GET request
How to do it…
- Update the code of the ...
Get Cucumber Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.