The objective of this project is to develop a basic Web Test Automation framework using Cucumber as a tool for writing tests in a BDD style (Behavior Driven Development). This framework will facilitate the automated testing of web applications, ensuring functionality and performance align with expected behaviors. It also utilizes the Page Object Model (POM) design pattern with Selenium, which can simplify the process of enhancing and updating the tests.
PROJECT FOLDER
├───src
│ ├───main
│ │ └───java
│ │ └───org
│ │ └───schuck
│ │ └───page_objects
│ │ LoginPage.java # Page Object representing WebElements and Actions
│ │
│ └───test
│ ├───java
│ │ ├───org
│ │ │ └───schuck
│ │ │ └───step_definitions
│ │ │ LoginPageSteps.java # Test step definitions for the Login Page
│ │ │
│ │ └───runner
│ │ CucumberTestRunner.java # Cucumber test runner
│ │
│ └───resources
│ │ testng.xml # TestNG suite configuration
│ │
│ └───features
│ LoginPage.feature # File describing the Login Page testing
│
└───target
└───surefire-reports
index.html # Results by surefire
This is a basic project. If you want to see a POM design with Page Factory, you can check out this other project: https://github.com/sschuckk/selenium-java-test-automation.
- Git: https://git-scm.com/downloads
- Java: https://www.oracle.com/java/technologies/downloads/
- Maven: https://maven.apache.org/install.html
git clone https://github.com/sschuckk/cucumber-java-test-automation/
The project can be run by a terminal or directly in your IDE.
In your terminal go to the project folder and run:
mvn test
mvn test --log-file ./target/mvn-test.log
After the execution of all tests, a link will be provided where you can click to access an online report, as shown below: