This repository contains automated UI tests for the Sauce Demo application. The test execution is implemented with multithreading to improve performance.
- UC-1: Empty Credentials — attempt to log in with both username and password fields empty; verify the displayed error message.
- UC-2: Missing Password — attempt to log in with only the username provided; verify the appropriate error message.
- UC-3: Successful Login — log in with valid credentials and verify redirection to the main page.
- Java 17 The primary programming language for writing test scripts.
- Maven For build and dependency management
- JUnit 5 The testing framework for structuring and running unit tests.
- Selenium WebDriver Used for web browser automation and executing test scenarios, specifically in Google Chrome.
- WebDriverManager WebDriverManager automates the management of WebDriver binaries so you don't need to manually download or configure them.
- Page Object Model: Implemented with
@FindByannotations for efficient web element localization. - Hamcrest Library for writing expressive and readable assertions in Java tests.
- LOG4J: For logging
- Clone the repository
git clone https://github.com/domagile/ta_training-java.git-
Run tests
Run tests in Chrome:
mvn clean testRun tests in Firefox:
mvn clean test -Dbrowser=firefoxRun tests in Edge:
mvn clean test -Dbrowser=edge
Test data can be taken from different files. Add "environment" property to define it:
mvn clean test -Denvironment=qa - To generate a report using one of the following command:
- Report will be generated into temp folder and opened in browser.
mvn allure:serve
or Report will be generated tо directory: target/site/allure-maven/index.html
mvn allure:reportAllure was used to generate test reports and attach screenshots for failed tests.
To install Allure, the step-by-step guide from the official documentation was used.
To generate the report without installing Allure CLI, the step-by-step guide from the Allure Maven GitHub page was used.
Screenshots for failed tests were configured according to the guide from the official Allure documentation.
- DriverSingleton – centralizes WebDriver initialization and cleanup using the Singleton pattern. Supports thread-safe parallel execution.
- Page Object Model – implemented with @FindBy annotations for maintainable UI mapping.
- BaseTest – provides common setup/teardown for tests.
- Maven Surefire Plugin - tests are executed in parallel.