Skip to content

An automated acceptance testing and reports framework for OpenCart e-commerce platform that replaces manual testing with reliable, fast, and consistent automated tests. Built using modern tools like Playwright and Cucumber.js with BDD methodology.

Notifications You must be signed in to change notification settings

aditya-cherukuru/opencart-acceptance-testing

Repository files navigation

OpenCart Automated Acceptance Testing Suite

Tests: TypeScript Β· Playwright Β· Cucumber
Academic Project: Software Testing Course - THWS University
Author: Aditya Cherukuru
Topic: Automated Acceptance Testing & Reporting


🎯 Project Overview

An automated acceptance testing and reports framework for OpenCart e-commerce platform that replaces manual testing with reliable, fast, and consistent automated tests. Built using modern tools like Playwright and Cucumber.js with BDD methodology.


πŸ› οΈ Technology Stack

Technology Purpose Why I Chose It
Playwright Browser automation Modern, fast, multi-browser support
Cucumber.js BDD framework Business-readable test scenarios
TypeScript Programming language Type safety and better maintainability
Node.js Runtime environment Rich ecosystem and easy setup

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • XAMPP (for OpenCart)
  • Git

Installation

Setup OpenCart

# Install XAMPP and start Apache + MySQL
# Download OpenCart to C:\xampp\htdocs\opencart\
# Complete OpenCart installation at http://localhost/opencart/

Clone and Install

git clone <your-repo-url>
cd opencart-acceptance-testing
npm install
npx playwright install

Run Tests

npm test

πŸ§ͺ Test Coverage

βœ… Implemented Test Scenarios

  • User Registration & Login – Account creation and authentication
  • Product Search & Filtering – Search functionality with sorting options
  • Shopping Cart Management – Add, update, remove items
  • Checkout Process – Guest and registered user checkout flows
  • Form Validation – Input validation and error handling

πŸ“Š Test Results Summary

  • βœ… Total Scenarios: 18
  • βœ… Passed: 17 (94%)
  • ❌ Failed: 1 (6%)
  • ⏱️ Execution Time: ~5 minutes
  • 🌐 Browsers: Chrome, Firefox, Safari

πŸƒβ€β™‚οΈ Running Tests

Basic Commands

npm test                    # Run all tests (visible browser)
npm run test:headless       # Run in headless mode (faster)
npm run test:chrome
npm run test:firefox
npm run test:safari
npm run test:debug          # Debug mode (slower execution)

Specific Test Execution

npx cucumber-js features/checkout-process.feature
npx cucumber-js --tags "@smoke"
npx cucumber-js features/user-registration.feature:15

πŸ“Š Reports & Documentation

Generate Reports

npm run report
npm run report:open

Report Features

  • πŸ“ˆ Execution Summary – Pass/fail statistics
  • πŸ–ΌοΈ Screenshots – Automatic capture on failures
  • ⏱️ Performance Metrics – Step execution timing
  • 🌐 Browser Information – Cross-browser results
  • πŸ“ Detailed Logs – Step-by-step execution details

πŸ—οΈ Project Structure

opencart-acceptance-testing/
β”œβ”€β”€ features/                    # BDD test scenarios
β”œβ”€β”€ step-definitions/           # Test step implementations
β”œβ”€β”€ page-objects/               # Page Object Model classes
β”œβ”€β”€ test-data/                  # Test data and fixtures
β”œβ”€β”€ utils/                      # Helper functions
β”œβ”€β”€ screenshots/                # Failure screenshots
└── cucumber-reports/           # JSON reports and Generated HTML Reports

πŸ”§ Technical Implementation

Page Object Model Example

export class CheckoutPage extends BasePage {
  private readonly emailField = this.page.locator('input[name="email"]')
  private readonly continueButton = this.page.locator('input[value="Continue"]')

  async fillBillingDetails(customer: CustomerData): Promise<void> {
    await this.emailField.fill(customer.email)
    await this.waitForElement(this.continueButton)
  }
}

BDD Scenario Example

Feature: Checkout Process
  Scenario: Complete guest checkout
    Given I have products in my cart
    When I proceed to checkout as guest
    And I fill in billing information
    And I select shipping method
    And I choose payment method
    Then I should see order confirmation

πŸ“ˆ Results & Impact

Metric Manual Testing Automated Testing Improvement
Execution Time 2-3 hours 5 minutes 96% faster
Browser Coverage 1 browser 3+ browsers 3x coverage
Consistency Variable 100% consistent No human error

πŸ”„ Lessons Learned

  • Start Small – Begin with most critical scenarios
  • Invest in Maintenance – Keep tests updated with application changes
  • Team Training – Ensure team understands BDD methodology
  • Proper Error Handling – Robust tests with good debugging

πŸš€ Future Enhancements

  • CI/CD Integration
  • API Testing
  • Performance Testing
  • Mobile Testing
  • Visual Regression Testing

πŸ”§ Troubleshooting

Includes solutions for:

  • Product search failures
  • Browser not launching
  • Reports not generating
  • Checkout failures
  • Database connection issues
  • Timeout errors
  • Screenshot failures

βœ… Environment Verification Checklist

Before running tests:

  • Apache + MySQL running (XAMPP)
  • OpenCart accessible via http://localhost/opencart/
  • Required products added
  • Search works manually
  • Playwright browsers installed

πŸ“š External Code Sources & References

Third-Party Libraries Used

Library Version Purpose License Source
Playwright 1.44.0 Browser automation Apache-2.0 GitHub
Cucumber.js 10.8.0 BDD framework (Gherkin) MIT GitHub
Winston 3.13.0 Logging MIT GitHub
csv-parse 5.5.6 CSV file parsing BSD-3-Clause GitHub
dotenv 16.4.5 Environment variable support BSD-2-Clause GitHub

Code Patterns & Templates Referenced

  • Page Object Model Pattern
    Source: Playwright POM Guide
    Used in: page-objects/
    Modifications: Custom waits, OpenCart-specific methods

  • Cucumber Hooks
    Source: Cucumber Docs
    Used in: hooks/hooks.ts
    Modifications: Screenshot capture, browser context management

  • GitHub Actions Workflow
    Source: Playwright CI Docs
    Used in: .github/workflows/acceptance-tests.yml
    Modifications: Multi-browser matrix, artifact archiving


πŸ€– AI Tool Usage Documentation

Tools Used

  • Tool: ChatGPT-4
  • Purpose: Class design, logging integration, documentation
  • Extent: 20% (structural scaffolding, prompt help)

Specific AI Tools Contributions

  1. Browser Manager Class

    • Prompt: "Create a TypeScript browser manager with error handling"
    • My Modifications: Logging integration, screenshot logic
  2. Step Definitions

    • Tool: GitHub Copilot
    • Contribution: Auto-complete suggestions
    • My Work: Business logic, validations, wait strategies

πŸ“¦ Detailed Dependency Documentation

Production Dependencies

Package Version Purpose License
@cucumber/cucumber ^10.8.0 BDD framework MIT
@playwright/test ^1.44.0 Test automation Apache-2.0
winston ^3.13.0 Logging MIT
csv-parse ^5.5.6 Test data parsing BSD-3-Clause
dotenv ^16.4.5 Env config BSD-2-Clause

Dev Dependencies

Package Version Purpose License
typescript ^5.4.5 Type-checking Apache-2.0
ts-node ^10.9.2 Run TS files MIT
@types/node ^20.14.2 Type definitions MIT

πŸ§ͺ Testing Strategy & Methodology

Principles

  • Independent: All tests can run in isolation
  • Repeatable: Same input β†’ same output
  • Fast Feedback: All tests < 5 min
  • Maintainable: POM abstraction layer

Exception Handling

  • Element not found β†’ Smart retries
  • Browser crash β†’ Restart mechanism
  • Missing data β†’ Dynamic fixture creation
  • Timeouts β†’ Custom timeouts per feature

πŸ“„ License

Created for educational use as part of the Software Testing course at THWS University.


πŸ‘€ Author

Aditya Cherukuru – Developer & Test Architect

  • Complete implementation and architecture
  • Page Object Model and BDD test design
  • Playwright + Cucumber.js integration
  • Reporting, debugging, and documentation
    Course: Software Testing – THWS University
    Submission Date: 22 June 2025

About

An automated acceptance testing and reports framework for OpenCart e-commerce platform that replaces manual testing with reliable, fast, and consistent automated tests. Built using modern tools like Playwright and Cucumber.js with BDD methodology.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages