# archimedesaj/fantasygold-interview-challenge architecture

> Architecture diagram of the GitHub repository archimedesaj/fantasygold-interview-challenge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/archimedesaj/fantasygold-interview-challenge
- Repository: https://github.com/archimedesaj/fantasygold-interview-challenge

## Overview

##### Project type and purpose
- This is a Java-based automated testing framework for an e-commerce website.
- Key purpose: verify site functionality via Selenium WebDriver, organize tests with TestNG, drive data from Excel (Apache POI), and produce HTML reports (ExtentReports).

##### File structure
- Root:
- pom.xml → Maven build and dependency management
- testng.xml → TestNG suite definition
- src/main/java/org/example/Main.java
- A simple entry point (optional for CLI triggers)
- src/main/resources/TestData/Credentials.xls
- Excel file serving as data source
- src/test/java
- Page_Objects/… → Page Object Model classes for each page (LoginPage, RegisterPage, ShopPage)
- DataUtils/ReadExcelFile.java → Utility to read Excel data (Apache POI)
- ExtentReportSetUp/ScreenshotListener.java → Reporting hooks (captures screenshots on failure)
- Test classes (LoginTests, RegisterTests, CheckoutTests, ProductFilterTests)

##### Extract insights from the README
- Java + Maven for build
- Selenium WebDriver for browser automation
- TestNG for test orchestration and reporting
- Apache POI for data-driven testing

a. Main components
- Test Runner (TestNG)
- Test Cases
- Page Objects
- WebDriver (browser driver)
- Data Layer (Excel files + ReadExcelFile)
- Reporting Layer (ExtentReports + ScreenshotListener)
- External System Under Test (e-commerce site at https://moreplexghana.com)
b. Relationships / Data flow
1. TestNG suite triggers Test Cases
2. Each Test Case invokes Page Object methods
3. Page Objects call WebDriver to perform browser actions against the live site
4. DataUtils reads inputs from the Excel file and feeds Tests / Page Objects
5. ScreenshotListener monitors test execution, captures failures
6. ExtentReports assembles logs, screenshots, and test outcomes into HTML report
c. Architectural patterns & principles
- Layered design:
- Test Layer (TestNG test classes)
- Page Layer (POM classes)
- Utility Layer (data readers, listener)
- Resource Layer (Excel files)
- Data-driven testing via Apache POI
- Separation of concerns: page locators/actions separated from test logic
d. Key technologies
- Selenium WebDriver
- TestNG
- Apache POI
- Maven
- ExtentReports

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Layer
    subgraph "Build & Configuration"
        pom["pom.xml"]:::build
        testng["testng.xml"]:::build
    end

    %% Main Entry
    Main["Main.java"]:::cli

    %% Data Layer
    subgraph "Data & Utilities"
        Excel(("Credentials.xls")):::datastore
        ReadExcel["ReadExcelFile.java"]:::utility
    end

    %% Test Layer
    subgraph "Test Layer" 
        LoginTests["LoginTests"]:::test
        RegisterTests["RegisterTests"]:::test
        CheckoutTests["CheckoutTests"]:::test
        ProductFilterTests["ProductFilterTests"]:::test
    end

    %% Page Object Layer
    subgraph "Page Object Model"
        LoginPage["LoginPage"]:::page
        RegisterPage["RegisterPage"]:::page
        ShopPage["ShopPage"]:::page
    end

    %% Driver & External
    WebDriver["Selenium WebDriver"]:::driver
    External["E-commerce Site"]:::external

    %% Reporting Layer
    subgraph "Reporting"
        ScreenshotListener["ScreenshotListener"]:::report
        ExtentReports["ExtentReports"]:::report
        HTMLReport["tes-reports.html"]:::report
    end

    %% Connections
    pom --> testng
    Main --> testng
    testng --> LoginTests
    testng --> RegisterTests
    testng --> CheckoutTests
    testng --> ProductFilterTests

    Excel --> ReadExcel
    ReadExcel --> LoginTests
    ReadExcel --> RegisterTests
    ReadExcel --> CheckoutTests
    ReadExcel --> ProductFilterTests

    LoginTests --> LoginPage
    RegisterTests --> RegisterPage
    CheckoutTests --> ShopPage
    ProductFilterTests --> ShopPage

    LoginPage --> WebDriver
    RegisterPage --> WebDriver
    ShopPage --> WebDriver

    WebDriver --> External

    testng --> ScreenshotListener
    ScreenshotListener --> ExtentReports
    LoginTests --> ExtentReports
    RegisterTests --> ExtentReports
    CheckoutTests --> ExtentReports
    ProductFilterTests --> ExtentReports
    ExtentReports --> HTMLReport

    %% Click Events
    click pom "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/pom.xml"
    click testng "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/testng.xml"
    click Main "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/main/java/org/example/Main.java"
    click Excel "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/main/resources/TestData/Credentials.xls"
    click ReadExcel "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/DataUtils/ReadExcelFile.java"
    click ScreenshotListener "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/ExtentReportSetUp/ScreenshotListener.java"
    click LoginTests "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/LoginTests.java"
    click RegisterTests "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/RegisterTests.java"
    click CheckoutTests "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/CheckoutTests.java"
    click ProductFilterTests "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/ProductFilterTests.java"
    click LoginPage "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/Page_Objects/LoginPage.java"
    click RegisterPage "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/Page_Objects/RegisterPage.java"
    click ShopPage "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/src/test/java/Page_Objects/ShopPage.java"
    click HTMLReport "https://github.com/archimedesaj/fantasygold-interview-challenge/blob/main/Interview-Challenge/tes-reports.html"

    %% Styles
    classDef build fill:#f0f8ff,stroke:#333,stroke-width:1px
    classDef cli fill:#e6e6fa,stroke:#333,stroke-width:1px
    classDef datastore fill:#fff5ba,stroke:#333,stroke-width:1px
    classDef utility fill:#fff5ba,stroke:#333,stroke-width:1px
    classDef test fill:#add8e6,stroke:#333,stroke-width:1px
    classDef page fill:#90ee90,stroke:#333,stroke-width:1px
    classDef driver fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef report fill:#ffcc99,stroke:#333,stroke-width:1px
```
