This project offers a framework and tools for automated web testing using Java, Selenium, and Cucumber, following Behavior-Driven Development (BDD) best practices and employing the Page Object Model design pattern.
This suite of tests is specifically designed to validate and test features on the demoblaze.com website. You'll find feature files under the tests/features
directory related to signup, login and adding products to the cart.
- JDK 21
- Lombok 1.18.30
- Selenium 4.15.0
- Cucumber 7.14.0
- config.json: Configuration file for variable data.
- pom.xml: Maven configuration file specifying project dependencies.
- run.bat: Script file for Windows environment execution.
- TestRunner.java: Cucumber test runner class.
- 001_Signup.feature: Specification file for signup feature.
- 002_Login.feature: Specification file for login feature.
- 003_AddProductToCart.feature: Specification file for adding products to cart feature.
- BasePage.java: Page class for header and footer.
- CartPage.java: Page class for cart functionality.
- HomePage.java: Page class for home page functionality.
- ProductPage.java: Page class for product-related functionality.
- AddProductToCartSteps.java: Step definitions for adding products to cart.
- Hooks.java: Cucumber hooks for setup and teardown.
- LoginSteps.java: Step definitions for login functionality.
- SignupSteps.java: Step definitions for signup functionality.
- Configuration.java: Utility class for configuration settings.
- Drivers.java: Configuration and management of WebDriver.
- Expect.java: Custom assertion functions.
- PageObject.java: Definition of the base structure of the Page Object Model.
- log4j.properties: Logging configuration file using Log4j.
-
Clone this repository:
git clone https://github.com/carlosvagnoni/JavaSeleniumCucumber.git cd JavaSeleniumCucumber
-
Compile the project:
mvn clean compile
- Make sure you have a browser installed and configured in the script (Chrome, Edge, or Firefox).
- You can configure the config.json file to adjust parameters such as the base URL(url) or the desired browser to use(navigator).
Run all the tests:
mvn test
Open report:
start "" "target\reports\demoblaze.html"
NOTE:
- Set up the respective environment variables beforehand.
- On Windows environments, you can directly execute the
run.bat
file.
If you have any questions or suggestions, feel free to contact me through my social media accounts.
Thank you for your interest in this project!