# nzjahngere/009_exception_hunters architecture

> Architecture diagram of the GitHub repository nzjahngere/009_exception_hunters, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nzjahngere/009_exception_hunters
- Repository: https://github.com/nzjahngere/009_exception_hunters

## Overview

##### Project Type and Purpose
- This is an automated testing framework dedicated to end-to-end testing of an online shopping platform. The framework covers UI, API, functional, and negative testing scenarios.
- Technologies used include Java, Selenium WebDriver, Cucumber (for BDD), Rest Assured (for API testing), JUnit, and Maven for build and dependency management.
- It follows best practices such as the Page Object Model (POM) to ensure maintainability.

##### File Structure
- Even though the provided file tree isn’t grouped into subdirectories like “src/main” or “src/test”, the README clarifies the intended structure:
- Page Objects reside in src/main/java/com/saucedemo.
- Step Definitions and the Test Runner live in src/test/java/com/saucedemo.
- Cucumber Feature Files (written in Gherkin) are stored in resources/features.
- The pom.xml defines the Maven build configuration.
- You also see several .java files corresponding to page objects (e.g., CartPage.java, CheckoutPage.java) and step definitions (e.g., ShoppingCartSteps.java, CheckoutAndPaymentSteps.java) alongside .feature files that drive the test scenarios.
- There are also various test plans and reports on execution (e.g., PDFs and Excel files), indicating an emphasis on comprehensive reporting and quality assurance.

##### Main Components
a. Test Artifacts:
- Cucumber Feature Files (Gherkin scenarios) that define test cases.
- Step Definitions in Java that map to the Gherkin steps.
- Page Objects (POM) which interact with the UI elements of the Sauce Demo application.
b. Test Execution and Build System:
- Maven (pom.xml) serves as the build tool that compiles and runs tests.
- JUnit is used for test assertions and running the test cases.
c. Testing Framework Components:
- Selenium WebDriver for automating browser interactions during UI tests.
- Rest Assured for API testing.
d. Test Reports:
- Cucumber HTML Reports generated in the target directory after test execution.
e. External Dependencies:
- Web drivers for browsers (Google Chrome/Firefox).
- The Sauce Demo application itself serves as the system under test.

##### Relationships and Interactions
- The feature files feed directly into the step definitions.
- Step definitions invoke methods on corresponding Page Objects (POM), which abstract the UI elements and interactions.
- Selenium WebDriver is called within the Page Objects to interact with the browser.
- For API tests, step definitions call Rest Assured based routines.
- The Maven build process orchestrates the compilation, test execution, and report generation.
- Generated reports are stored in the target directory and can be accessed via a browser.

##### Architectural Patterns and Principles
- Use of the Page Object Model (POM) to segregate the UI interactions.
- Adoption of Behavior Driven Development (BDD) with Cucumber for clear, human-readable test cases.
- Separation of concerns is evident: feature definition, test logic (step definitions), and UI interaction logic (page objects) are clearly separated.
- Modular design ensures that UI and API tests are maintained independently while integrated under the same testing framework.

##### Detail and Clarity
- That every component is clearly labeled.
- Keep components as granular as possible to capture the essential architecture and integration points of the system.

## Diagram (Mermaid)

```mermaid
graph TD
    A["Maven Build & JUnit"]:::build

    subgraph "Test Artifacts"
        B["Cucumber Feature Files"]:::artifacts
        f1["BackValid.feature"]:::artifacts
        f2["CheckPay.feature"]:::artifacts
        f3["ItemSearchDetails.feature"]:::artifacts
        f4["Navigation.feature"]:::artifacts
        f5["OrdHist.feature"]:::artifacts
        f6["ShoppingCart.feature"]:::artifacts
        f7["UITesting.feature"]:::artifacts
        f8["UserAuth.feature"]:::artifacts
        B --> f1
        B --> f2
        B --> f3
        B --> f4
        B --> f5
        B --> f6
        B --> f7
        B --> f8
    end

    subgraph "Test Logic"
        C["Step Definitions"]:::testLogic
        s1["BackendValidationSteps.java"]:::testLogic
        s2["CheckoutAndPaymentSteps.java"]:::testLogic
        s3["NavigationSteps.java"]:::testLogic
        s4["OrderHistorySteps.java"]:::testLogic
        s5["ProductSearchAndDetailsSteps.java"]:::testLogic
        s6["ShoppingCartSteps.java"]:::testLogic
        s7["UITestingSteps.java"]:::testLogic
        s8["UserAuthSteps.java"]:::testLogic
        s9["Hooks.java"]:::testLogic
        C --> s1
        C --> s2
        C --> s3
        C --> s4
        C --> s5
        C --> s6
        C --> s7
        C --> s8
        C --> s9
    end

    subgraph "UI Interaction Layer"
        D["Page Objects (POM)"]:::ui
        p1["CartPage.java"]:::ui
        p2["CheckoutPage.java"]:::ui
        p3["InventoryPage.java"]:::ui
        p4["PaymentPage.java"]:::ui
        p5["SearchPage.java"]:::ui
        p6["ItemDetails.java"]:::ui
        p7["OrdHist.java"]:::ui
        p8["UserAuth.java"]:::ui
        D --> p1
        D --> p2
        D --> p3
        D --> p4
        D --> p5
        D --> p6
        D --> p7
        D --> p8
        E["Selenium WebDriver"]:::automation
        D --> E
    end

    F["Rest Assured API Tests"]:::api
    G["Cucumber HTML Report"]:::report
    H["Sauce Demo Platform"]:::external

    %% Connections
    A -->|"triggers"| B
    B -->|"defines"| C
    A -->|"initiates"| C
    C -->|"invokes"| D
    C -->|"calls"| F
    E -->|"tests"| H
    A -->|"generates"| G

    %% Click Events
    click A "https://github.com/nzjahngere/009_exception_hunters/blob/main/pom.xml"
    click f1 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/BackValid.feature"
    click f2 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/CheckPay.feature"
    click f3 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/ItemSearchDetails.feature"
    click f4 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/Navigation.feature"
    click f5 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/OrdHist.feature"
    click f6 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/ShoppingCart.feature"
    click f7 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/UITesting.feature"
    click f8 "https://github.com/nzjahngere/009_exception_hunters/blob/main/resources/features/UserAuth.feature"
    click s1 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/BackendValidationSteps.java"
    click s2 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/CheckoutAndPaymentSteps.java"
    click s3 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/NavigationSteps.java"
    click s4 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/OrderHistorySteps.java"
    click s5 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/ProductSearchAndDetailsSteps.java"
    click s6 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/ShoppingCartSteps.java"
    click s7 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/UITestingSteps.java"
    click s8 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/UserAuthSteps.java"
    click s9 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/test/java/com/saucedemo/Hooks.java"
    click p1 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/CartPage.java"
    click p2 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/CheckoutPage.java"
    click p3 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/InventoryPage.java"
    click p4 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/PaymentPage.java"
    click p5 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/SearchPage.java"
    click p6 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/ItemDetails.java"
    click p7 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/OrdHist.java"
    click p8 "https://github.com/nzjahngere/009_exception_hunters/blob/main/src/main/java/com/saucedemo/UserAuth.java"

    %% Styles
    classDef build fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef artifacts fill:#FDD5B1,stroke:#000,stroke-width:2px;
    classDef testLogic fill:#C1FFC1,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFDEAD,stroke:#000,stroke-width:2px;
    classDef automation fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef api fill:#FFC0CB,stroke:#000,stroke-width:2px;
    classDef report fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef external fill:#FFE4E1,stroke:#000,stroke-width:2px;
```
