Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Automation Testing Framework

An end-to-end Selenium + TestNG automation project built on saucedemo.com, following the Page Object Model (POM) design pattern. Includes both UI and API test coverage.

What This Project Does

Automates and verifies the full purchase journey on a demo e-commerce site:

Login → Add to Cart → View Cart → Checkout Form → Continue → Order Overview → Finish → Order Confirmation

Each major stage is independently verified with assertions, so a failure immediately points to the exact stage that broke — not just a generic "test failed."

Tech Stack

  • Java — core language
  • Selenium WebDriver 4.45.0 — browser automation
  • TestNG 7.10.2 — test framework, assertions, lifecycle management
  • RestAssured 5.5.0 — API testing
  • Maven — dependency management and build
  • Page Object Model (POM) — design pattern for maintainable, reusable page interactions

Project Structure

src/main/java/pages/       → Page Objects (locators + actions, one class per page)
    LoginPage.java
    ProductsPage.java
    CartPage.java
    CheckoutPage.java
    CheckoutOverview.java

src/test/java/tests/       → Test classes (@Test methods that use the Page Objects)
    LoginTests.java
    CartTests.java
    CheckoutTests.java
    ApiTests.java

pom.xml                    → Project dependencies (Selenium, TestNG, RestAssured)

Design Approach

Every Page Object represents exactly one page in the flow, and owns only the locators/actions that physically exist on that page — e.g. the "Checkout" button lives in CartPage (since it's shown on the cart page), not in CheckoutPage (the actual checkout form). This kept each class focused and made the test flow easy to follow.

@BeforeMethod / @AfterMethod handle browser setup and teardown once, rather than repeating it in every test.

Test Coverage

Test Class Verifies
LoginTests Successful login redirects correctly (page title check)
CartTests An item is correctly added to the cart (cart count check)
CheckoutTests The full 7-step purchase flow completes, with checks after login, after add-to-cart, and at final order confirmation
ApiTests A GET request against a public API returns the correct status code and response data

Running the Tests

  1. Clone the repo and open it in Eclipse (or any Maven-compatible IDE) as an existing Maven project
  2. Right-click a test class → Run As → TestNG Test
  3. Chrome will open automatically — Selenium 4.6+ manages the browser driver itself, no manual setup needed

Notes

This project was built as a hands-on learning exercise to apply Selenium, TestNG, POM, and API testing concepts in one cohesive, realistic flow — including working through genuine debugging scenarios (locator mismatches, timing issues, and multi-page flow discovery) rather than following a fixed script.

About

Selenium + TestNG automation framework using Page Object Model, covering UI and API test coverage for an e-commerce checkout flow.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages