A comprehensive, production-ready automated testing suite for the SwagLabs (SauceDemo) e-commerce platform. This project demonstrates professional test automation practices with a focus on scalability, maintainability, and robust reporting.
This automation framework was developed as a practical training exercise to master advanced test automation concepts and industry best practices. The project covers the complete end-to-end user journey on the SwagLabs platform, from authentication through order completion, ensuring critical business functionality remains intact through continuous regression testing.
Key Achievement: Implemented a professional-grade testing framework with clean code architecture, comprehensive error handling, and detailed test reporting capabilities.
| Component | Technology | Version |
|---|---|---|
| Programming Language | Java | 21 |
| Test Automation Framework | Selenium WebDriver | 4.38.0 |
| Test Runner & Orchestration | TestNG | 7.10.2 |
| Build Automation | Maven | Latest |
| Reporting & Analytics | Allure Reports | 2.32.0 |
| Logging Framework | Log4j2 | 2.25.2 |
| Data Serialization | Gson | 2.13.2 |
| Test Data Generation | Java Faker | 1.0.2 |
| Configuration Management | YAML (SnakeYAML) | 2.2 |
Implemented a clean separation between test logic and UI element locators, ensuring:
- High code reusability and maintainability
- Easy updates when UI elements change
- Improved test readability and organization
Supports multiple test scenarios through:
- JSON-based test data files for flexible data management
- Java Faker for dynamic, realistic test data generation
- Parameterized tests for comprehensive coverage
- Allure Reports: Interactive, detailed test reports with step-by-step execution flow
- Automatic Screenshots: Captures screenshots on test failures for quick debugging
- Execution Metrics: Detailed pass/fail statistics and trend analysis
- Log4j2 Integration: Comprehensive logging at multiple levels (INFO, WARN, ERROR)
- Execution Trails: Detailed logs for audit trails and troubleshooting
- Emoji-Enhanced Logs: Visual indicators for quick log scanning (β
, β,
β οΈ , π)
- InvokedMethodListener: Tracks test method invocations and execution flow
- ITestListener: Handles test lifecycle events, failures, and reporting
- DriverFactory Pattern: Centralized browser initialization supporting multiple browsers
- Easy Scalability: Add new browsers with minimal code changes
- DataUtilies: Manages JSON data and properties file reading
- LogsUtils: Simplified logging with consistent formatting
- Utilty: Common helper methods for repeated operations (login, waits, etc.)
SwagLabs-Automation-Project/
βββ src/
β βββ main/java/
β β βββ DriverFactory/
β β β βββ DriverFactory.java # Browser initialization & management
β β βββ Pages/
β β β βββ LoginPage.java # Login page object
β β β βββ LandingPage.java # Home page object
β β β βββ CartPage.java # Shopping cart page object
β β β βββ CheckOutPage.java # Checkout page object
β β β βββ OverViewPage.java # Order overview page object
β β β βββ FinishingOrderPage.java # Order confirmation page object
β β βββ Utilities/
β β βββ DataUtilies.java # JSON & properties file handling
β β βββ LogsUtils.java # Logging utilities
β β βββ Utilty.java # Common helper methods
β βββ main/resources/
β β βββ allure.properties # Allure report configuration
β β βββ log4j2.properties # Log4j2 configuration
β βββ test/java/
β βββ Listeners/
β β βββ ITestListener.java # TestNG listener for test events
β β βββ InvokedMethodListener.java # Method invocation tracking
β βββ Tests/
β β βββ LoginTest.java # Login test cases
β β βββ LandingTest.java # Landing page test cases
β β βββ CartTest.java # Cart functionality test cases
β β βββ CheckOutTest.java # Checkout flow test cases
β β βββ OverViewTest.java # Order overview test cases
β β βββ FinishingOrderTest.java # Order completion test cases
β βββ resources/TestData/
β βββ ValidLogin.json # Valid login credentials
β βββ InvalidLogin.json # Invalid login credentials
β βββ usersData.json # User test data
β βββ environment.properties # Environment configuration
βββ Test Runner/
β βββ LoginSuite.xml # Login test suite
β βββ LandingSuite.xml # Landing page test suite
β βββ CartSuite.xml # Cart test suite
β βββ CheckOutSuit.xml # Checkout test suite
β βββ OverViewSuit.xml # Overview test suite
β βββ FinishingSuit.xml # Finishing order test suite
β βββ RegressionSuit.xml # Full regression suite
βββ Test-Outputs/
β βββ Logs/ # Test execution logs
β βββ ScreenShoots/ # Failure screenshots
βββ pom.xml # Maven configuration
βββ README.md # This file
- β Valid login with correct credentials
- β Invalid username with valid password
- β Valid username with invalid password
- β Empty username and password
- β Empty username only
- β Empty password only
- β Login page identity validation
- β Product listing verification
- β Product sorting functionality
- β Page layout and element visibility
- β Add products to cart
- β Remove products from cart
- β Cart count verification
- β Product quantity comparison
- β Checkout step one (user information entry)
- β Checkout step two (order review)
- β Checkout completion
- β Order overview verification
- β Order finalization
- β Confirmation message validation
- JDK 21 or higher installed
- Maven (3.6.0 or later) installed
- Chrome or Firefox browser installed
- Git for version control
-
Clone the repository:
git clone https://github.com/MondyBourham/SwagLabs-Automation-Project.git cd SwagLabs-Automation-Project -
Install dependencies:
mvn clean install
-
Configure environment settings:
- Update
src/test/resources/TestData/environment.propertieswith your browser and URL preferences - Ensure test data files are properly configured
- Update
mvn testmvn test -Dsuite=Test Runner/LoginSuite.xmlmvn test -Dsuite=Test Runner/RegressionSuit.xmlUpdate environment.properties and run:
mvn testmvn clean test
allure serve target/allure-resultsThis command will:
- Execute all tests
- Generate detailed Allure reports
- Open the report in your default browser
- Step-by-step test execution flow
- Failure screenshots and error messages
- Test duration and performance metrics
- Historical trend analysis
- Environment and browser information
Located in src/test/resources/TestData/:
ValidLogin.json:
{
"username": "standard_user",
"password": "secret_sauce"
}InvalidLogin.json:
{
"username": "invalid_user",
"password": "wrong_password"
}Edit environment.properties to customize:
- Browser type (Chrome, Firefox, Edge)
- Application URLs
- Timeout values
- Logging levels
Controls logging output format, level, and file management.
Manages Allure report generation and display settings.
This project demonstrates proficiency in:
- Advanced Selenium WebDriver usage
- Page Object Model design pattern
- TestNG framework and annotations
- Data-driven testing approaches
- Custom listener implementation
- Professional logging and reporting
- Maven build automation
- Git version control
- Test automation best practices
- Code Organization: Clear separation of concerns (Pages, Tests, Utilities)
- Naming Conventions: Descriptive, consistent naming across the codebase
- Error Handling: Comprehensive exception handling with meaningful error messages
- Waits Strategy: Explicit waits instead of hard sleeps for reliability
- Test Independence: Each test is independent and can run in any order
- Reusability: Common operations abstracted into utility methods
- Documentation: Clear comments and documentation throughout the code
- CI/CD Ready: Maven configuration supports automated pipeline integration
Issue: Tests fail with "Element not found" exception
- Solution: Verify the application URL is correct in
environment.properties - Check browser compatibility and WebDriver version
Issue: Allure reports not generating
- Solution: Ensure
allure-commandlineis installed:npm install -g allure-commandline - Run:
allure serve target/allure-results
Issue: Tests timeout
- Solution: Increase timeout values in
environment.properties - Check internet connection and application responsiveness
For issues, suggestions, or contributions:
- Create an issue in the GitHub repository
- Submit a pull request with improvements
- Share feedback and best practices
This project is open source and available for educational and professional use.
This project was developed as part of professional training in Software Quality Assurance and Test Automation, demonstrating industry best practices and modern automation frameworks.
Last Updated: December 29, 2025
Project Status: β Active & Maintained