Automation Framework for Web Application tests using Cucumber and Selenium
This project is to implement Page Object Model pattern with Cucumber and Selenium Webdriver for a sample Google search scenario. Project was developed using:
- Cucumber - 6.10.4 - latest version
- Selenium - 3.141.59 - latest version
- Lombok - annotations and clean code
- Page Object Model is a design pattern that creates Object Repository for web UI elements and it reduces code duplication and improves test maintenance.
- Page Object classes can be found at src/test/java/com/automation/demo/pages package
- Acceptance Test written as Cucumber feature file can be found at src/test/resources/features/GoogleSearch.feature
- This test launches Google home page in Chrome browser, performs a search and retrieves first results detail to print in terminal
- Environment Requirements: Maven v3.5.4 or later, Java 1.8 or later, Eclipse or IntelliJ IDE
- After cloning the project, compile using the IDE Maven plugin or
mvn clean compile
- Review the code to understand the flow
- src/test/java - has the code for Cucumber tests implementation
- src/test/resources - has the feature file
mvn clean test
- This will run the scenarios in Cucumber feature files
Alternative way to run the project is by use of: TestRunner at src/test/java/com/automation/demo/TestRunner.java or Using IDE Run configuration, for IntelliJ:
- Right click project and click Run as
- Select Maven Build
- Enter goals - clean test
- Click Run
After execution, reports can be accessible via the link displayed in the maven logs (provided by Cucumber latest version).
When this project is integrated in a Jenkins pipeline, cucumber.json file in target/cucumber-reports can be integrated in the Build using Jenkins Cucumber plugin