0% found this document useful (0 votes)
8 views4 pages

Automation NBT

The document outlines a project for creating feature files and step definitions using Cucumber with Selenium WebDriver for testing a web application. It includes steps for setting up the testing environment, writing feature files and step definitions, integrating Cucumber with Selenium, executing tests, and refining the automation framework. Additionally, it provides specific test cases for searching flights and registering on a demo site, along with expected results and learning outcomes.

Uploaded by

imad.mansoor786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Automation NBT

The document outlines a project for creating feature files and step definitions using Cucumber with Selenium WebDriver for testing a web application. It includes steps for setting up the testing environment, writing feature files and step definitions, integrating Cucumber with Selenium, executing tests, and refining the automation framework. Additionally, it provides specific test cases for searching flights and registering on a demo site, along with expected results and learning outcomes.

Uploaded by

imad.mansoor786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Project Overview:

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:

1. Set up your testing environment:

• 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.

2. Write feature files:

• 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.

3. Write step definitions:

• 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.

4. Integrate Cucumber with Selenium WebDriver:

• 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.

5. Execute tests using Cucumber:

• Run the Cucumber test runner to execute the tests.

• Use the Cucumber test runner to generate test reports in HTML or JSON format.

6. Refine your feature files, step definitions, and automation framework:

Internal - General Use


• Refine your feature files and step definitions to ensure that they are accurate and
comprehensive.

• Optimize your automation framework to improve performance and reliability.

• Use the information captured in the test reports to identify areas for improvement and
optimize your testing process.

TC1: Search Flights

Step No Description Expected Result Remark


1 Open URL Clear trip page has to URL should be
Clear trip: #1 Travel Booking Site, be displayed configured in config.
Book Hotels, Flights Online with properties file
Great Offers.
2 Choose One way/Round One way or round-trip
appropriate UI
elements has to be
displayed
3 Enter the <From> and <TO> Appropriate <From use TestNG
information >and <To> details has @DataProvider
to be displayed annotation to make
script data driven
4 Select Date from the Calendar Selected date has to
be displayed
5 Click on Search flights Search results has to Take screenshot of the
be displayed in the page and store in the
Next Page Screenshot Folder.
Provide ExtendReport
and TestNG

Learning Outcome:

✓ Using Appropriate TestNG Annotations


✓ Working with. properties file
✓ Data Driven using Data Provider
✓ Working With POM/Page Factory
✓ Working with MAVEN Structure

Internal - General Use


Tc2: Retrieve the Top 5 search Results

Step No Description Expected Result Remark


1 Open URL Clear trip page should URL should be
Clear trip: #1 Travel Booking Site, be displayed configured in config.
Book Hotels, Flights Online with Properties file
Great Offers.
2 Choose One way/Round One way or round-trip
appropriate UI
elements should be
displayed
3 Enter the <From> and <TO> Appropriate <From> Take search data from
information and <To> details have search.xlsx and use
to be displayed TestNG
@DataProvider
annotation to make
script data driven
4 Select Date from the Calendar Selected date should
be displayed
5 Click on Search flights Search results has to Write the search
be displayed in the results in the Notepad
Next Page and get the
first five details

Note: Use Relative customized XPath if required

References:

https://www.toolsqa.com/selenium-webdriver/write-effective-xpaths/

Learning Outcome:

✓ Using Appropriate TestNG Annotations


✓ Working with. properties file
✓ Writing in notepad
✓ Effective usage of Dynamic XPath
✓ Data Driven using Excel and Data Provider
✓ Working With POM/Page Factory
✓ Working with MAVEN Structure

Internal - General Use


Cucumber Framework

Tc 3: https://demo.automationtesting.in/Register.html

Step Description Expected Result Remark


No
1 Open URL Demo URL should be
https://demo.automationtesting.in/Register.html Automation configured in
Testing will config.
launched Properties file
2 Enter the Details-Mandatory details Appropriate Use Scenario
Valid & Invalid details has to Outline for data
filled using Data driven testing
Driven testing
3 Upload the Profile Picture Handling file
uploading
4 Check Register Your registration Get success
completed message and
save in text file
and capture the
screenshot and
store in
screenshot
folder

Learning Outcome:

✓ Using Appropriate cucumber Feature and options


✓ Working with. properties file
✓ Effective usage of Dynamic XPath
✓ Data Driven using Scenario Outline
✓ File Uploading
✓ Working With POM/Page Factory
✓ Working with MAVEN Structure
✓ Cucumber framework

Internal - General Use

You might also like