Skip to content

Atmozo/autodemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 autodemo

Step-by-Step Automation Project Testing with Sauce Demo


📦 Project Overview

This is an end-to-end Selenium WebDriver automation project using TestNG, ExtentReports, and other key tools. The test cases interact with SauceDemo and simulate real-world shopping flow scenarios.

🔐 Login credentials and test data are dynamically read from an external data.xlsx file, allowing for easy data-driven testing.


🛠️ Project Setup

This project was scaffolded using the Maven maven-archetype-quickstart template.


⚙️ Generate the Project (Optional for Reference)

mvn archetype:generate \
  -DgroupId=com.saucedemo \
  -DartifactId=autodemo \
  -DarchetypeArtifactId=maven-archetype-quickstart \
  -DinteractiveMode=false

🔍 Command Breakdown

Command Part Description
mvn Invokes Maven
archetype:generate Uses the Maven Archetype plugin to scaffold the project
-DgroupId=com.saucedemo Base package structure (com/saucedemo)
-DartifactId=autodemo Project name and folder
-DarchetypeArtifactId=... Uses the quickstart archetype
-DinteractiveMode=false Runs non-interactively

🗂️ Project structure created:

autodemo/
 └── src/
     ├── main/java/com/saucedemo/App.java
     └── test/java/com/saucedemo/AppTest.java
 └── pom.xml

📊 POM Dependencies

Here's the full list of dependencies used in pom.xml:

<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.31.0</version>
  </dependency>

  <dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>6.0.1</version>
  </dependency>

  <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.11.0</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.2.5</version>
  </dependency>

  <dependency>
    <groupId>com.github.javafaker</groupId>
    <artifactId>javafaker</artifactId>
    <version>1.0.2</version>
  </dependency>

  <dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>5.1.1</version>
  </dependency>
</dependencies>

📁 Data-Driven Testing

We use Apache POI to read from the data.xlsx file located in the project root or resources.
It contains:

  • ✅ Login credentials (standard_user, secret_sauce)
  • ✅ Other test inputs like product names

The ExcelUtil class reads the .xlsx sheet and feeds data into tests dynamically.


▶️ Running the Tests

To execute a specific test class such as PurchaseItem, use:

mvn -Dtest=PurchaseItem test

Or run all tests:

mvn test

Skip test execution during build:

mvn clean install -DskipTests

🔄 Reload Dependencies

mvn dependency:resolve

🧭 Test Workflow (Visual Guide)

Here’s a simplified workflow of what happens when tests run:

graph TD
    A[Start Test] --> B[Load Config & Excel Data]
    B --> C[Initialize WebDriver using WebDriverManager]
    C --> D[Launch SauceDemo Website]
    D --> E[Perform Login with Excel credentials]
    E --> F[Add Items to Cart]
    F --> G[Proceed to Checkout]
    G --> H[Validate Summary & Order Confirmation]
    H --> I[Generate Extent Report]
    I --> J[Close Browser]
    J --> K[Test Completed]
Loading

📌 Summary

  • 🔍 Built with Maven, Java 17, TestNG, Selenium, and ExtentReports
  • 🧪 Supports data-driven testing with Excel via Apache POI
  • 🧼 Easy to maintain and extend with modular page object classes

About

Step-by-Step Automation Project Testing: Sauce Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages