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