Skip to content

Desh07/saucedemo-selenium-automation-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium Automation Learning

This project is a UI test automation framework built using Selenium WebDriver and TestNG to test the SauceDemo e-commerce application.

It follows the Page Object Model (POM) design pattern to ensure scalability, readability, and maintainability of test automation code.

Java Selenium TestNG


🚀 Overview

This project demonstrates a maintainable Selenium test framework with reusable page objects, TestNG data providers, explicit waits, screenshot capture, and ExtentReports output.

It currently covers:

  • Login validation
  • Inventory page checks
  • Add to cart and remove from cart flows
  • Product sorting checks
  • Data-driven runs with multiple SauceDemo users

🛠 Tech Stack

  • Java 21
  • Maven
  • Selenium WebDriver 4
  • TestNG
  • ExtentReports
  • GitHub Actions (CI/CD)
  • Apache Commons IO

🔥 Key Features

  • Page Object Model (POM) architecture
  • Data-driven testing using TestNG DataProvider
  • Automated CI/CD pipeline (GitHub Actions)
  • ExtentReports integration for test reporting
  • Screenshot capture for test evidence
  • Headless browser execution support

📁 Project Structure

src/main/java/Pages/     Page objects
src/test/java/base/      WebDriver setup and teardown
src/test/java/tests/     TestNG test classes
src/test/java/utils/     Test data, reports, screenshots
screenshots/             Captured test evidence
testng.xml               Suite definition
pom.xml                  Maven build configuration

🧪 Test Coverage

  • Valid login
  • Invalid login
  • Empty login submission
  • Inventory page visibility
  • Add item to cart
  • Open cart and verify contents
  • Remove item from cart
  • Sort products A to Z
  • Sort products Z to A
  • Sort products by price low to high
  • Sort products by price high to low
  • Product count validation with multiple users

Prerequisites

  • Java 21
  • Maven 3.9+
  • Google Chrome installed
  • Internet access for SauceDemo

▶️ Running the Tests

Run the full suite:

mvn clean test

Run a single test class:

mvn -Dtest=LoginTests test

Run a single test method:

mvn -Dtest=LoginTests#invalidLoginTest test

📸 Screenshots

Sorting (Price High to Low)

price high to low

Sorting (Z-A)

Sorting (Z-A)

Cart with Item

Cart with Item

Cart After Removal

Cart after removal

Invalid Login

Invalid Login

Empty Login

Empty Login


📊 Reporting

After execution, the framework generates:

  • TestNG/Surefire output in target/surefire-reports
  • ExtentReports HTML output in test-output/ExtentReport.html
  • Screenshots in screenshots/

Notes

  • Tests use explicit waits in the page objects.
  • WebDriver setup opens SauceDemo automatically before each test.
  • Chrome runs in headless mode in the current test configuration.
  • Readme.md is kept in the repo, but README.md is the file GitHub will render.

👨‍💻 Author

Deshanth Vishvalingam

About

UI test automation framework using Selenium, Java, TestNG, and CI/CD (GitHub Actions) for SauceDemo application testing.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages