This project automates login scenarios on SauceDemo using:
- Java
- Cucumber (BDD)
- Selenium WebDriver with ChromeDriver
- Page Object Model (POM)
- Gradle build system
- Allure for test reporting
- Java 11 or higher installed
- Chrome browser installed
- ChromeDriver executable downloaded and available locally
-
To run all tests:
./gradlew test -
To run tests filtered by tag, e.g.
@positiveor@negative:./gradlew test -Dcucumber.filter.tags="@positive or @negative"
-
After running tests, generate and open the report with:
allure serve build/allure-results
-
If you don’t have Allure installed, follow the instructions at Allure docs.
-
Element locators are stored in
.propertiesfiles undersrc/test/resources/elements/. -
Each Page Object class loads its corresponding
.propertiesfile dynamically by name. -
Example locator keys:
USERNAME_INPUT = #user-name PASSWORD_INPUT = #password LOGIN_BUTTON = #login-button ERROR_MESSAGE = h3[data-test='error']
- Old Allure results are deleted automatically before each test run for clean reporting.
- Dynamic tags allow flexible test execution without modifying code.
- Uses Page Object Model for better maintainability.
Happy testing! 🚀