Automation NBT
Automation NBT
Exercise: Writing Feature Files and Step Definitions using Cucumber with Selenium WebDriver
In this exercise, you will be creating feature files and step definitions using Cucumber with Selenium
WebDriver, and generating test reports with Cucumber. The web application we will be using is
https://www.cleartrip.com/.
Project Structure:
• Download and install the latest version of Selenium WebDriver for Java.
• Create a new Java project in your IDE and add the necessary dependencies for Selenium
WebDriver and Cucumber.
• Create a basic project structure, including directories for feature files, step definitions, and
test results.
• Write feature files using the Gherkin syntax to describe the behaviour of the web
application.
• Include scenarios and steps in the feature files that cover different functionalities of the web
application, such as searching for flights, and booking a flight.
• Write step definitions in Java to map the steps in the feature files to actions in the Selenium
WebDriver code.
• Use the @Given, @When, and @Then annotations to define the step definitions for each
step in the feature files.
• Create reusable step definitions that can be used across multiple feature files.
• Create a new Java class that sets up the Selenium WebDriver instance and initializes the
Cucumber test runner.
• Use the @CucumberOptions annotation to configure the Cucumber test runner, including
the location of the feature files and step definitions.
• Use the Cucumber test runner to generate test reports in HTML or JSON format.
• Use the information captured in the test reports to identify areas for improvement and
optimize your testing process.
Learning Outcome:
References:
https://www.toolsqa.com/selenium-webdriver/write-effective-xpaths/
Learning Outcome:
Tc 3: https://demo.automationtesting.in/Register.html
Learning Outcome: