# asingh403/api-pom-nov21 architecture

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

- Interactive diagram: https://gitdiagram.com/asingh403/api-pom-nov21
- Repository: https://github.com/asingh403/api-pom-nov21

## Overview

##### Main Components
- Test Execution Engine – Represented by TestNG’s test suite (testng.xml) that triggers the execution of the test cases.
- API Test Modules – The core API test classes (such as GetImgurAPITest) that interact with the REST client.
- REST Client – The module handling API calls (e.g., RestClient.java) that manages multipart requests including file/image uploads.
- Utility Modules – Support components like:
- Excel Utility for reading/populating test data.
- Token Utility for handling authentication tokens.
- Reporting Components – The listeners and reporting modules:
- Extent Report Listener for generating HTML reports.
- Allure Reporter integration (with JSON outputs and a separate results directory).
- CI/CD Pipeline – Jenkins integration which likely pulls the framework, executes test suites, and triggers reporting.
- Build/Report Artifacts – The build directory for HTML reports (Extent), and the allure-results directory for Allure reports.

##### Relationships and Interactions
- The Test Execution Engine should be connected to the API Test Modules, which in turn use the REST Client to interact with external APIs (such as the Imgur API).
- Link the Utility Modules (Excel Utility and Token Utility) to the test modules – showing that they supply necessary data for the tests (for example, token management and test data input).

##### Architectural Patterns & Design Principles
- Use of the Page Object Model style even though it is customized for API testing, which separates concerns (test logic versus utility functions).
- Modular separation – each functionality (REST operations, token handling, Excel utilities, and reporting) is isolated and reusable.
- To note that the CI/CD component integrates at the execution level to ensure continuous delivery and test reporting.

##### Relevant Technologies & Frameworks
- TestNG is used for driving test executions.
- REST client tools/libraries for API interactions.
- Utility libraries for handling Excel documents and token generation.
- Reporting tools: Extent Reports and Allure for HTML and JSON-based report generation.
- Jenkins for CI/CD pipeline orchestration.

a. CI/CD Pipeline:
b. Build the Testing Core:
- “REST Client Module” (for making HTTP calls including file uploads).
- “Utility Modules” (split this into “Token Utility” and “Excel Utility”).
c. Reporting Flow:
- Resulting output directed from these listeners to their respective artifact directories (“build folder” for Extent reports and “allure-results” for Allure).
d. External Interactions:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Documentation Group
    PD["Project Documentation (README)"]:::doc

    %% CI/CD Pipeline
    JENKINS["Jenkins CI/CD"]:::ci

    %% Test Execution Engine
    TESTNG["Test Execution Engine (TestNG)"]:::test

    %% API Test Cases
    APITEST["API Test Cases"]:::test

    %% REST Client Module
    RESTCLIENT["REST Client Module"]:::client

    %% External API
    IMGUR["External API (Imgur)"]:::external

    %% Utility Modules Subgraph
    subgraph "Utility Modules"
        TOKEN["Token Utility"]:::util
        EXCEL["Excel Utility"]:::util
    end

    %% Reporting Components
    EXTENT["ExtentReportListener"]:::report
    ALLURE["AllureReportListener"]:::report

    %% Artifact Directories Subgraph
    subgraph "Report Artifacts"
        EXTENT_ARTIFACT["Extent Reports (build folder)"]:::artifact
        ALLURE_ARTIFACT["Allure Results (allure-results)"]:::artifact
    end

    %% Connections
    PD --- JENKINS
    JENKINS -->|"triggers"| TESTNG
    TESTNG -->|"executes"| APITEST
    APITEST -->|"calls"| RESTCLIENT
    RESTCLIENT -->|"communicates"| IMGUR
    TOKEN -->|"suppliesToken"| APITEST
    EXCEL -->|"suppliesData"| APITEST
    APITEST -->|"sendsResults"| EXTENT
    APITEST -->|"sendsResults"| ALLURE
    EXTENT -->|"outputsReport"| EXTENT_ARTIFACT
    ALLURE -->|"outputsReport"| ALLURE_ARTIFACT

    %% Click Events
    click PD "https://github.com/asingh403/api-pom-nov21/blob/Trunk/README.md"

    %% Styles
    classDef ci fill:#f59e0b,stroke:#333,stroke-width:2px,color:#fff;
    classDef test fill:#bfdbfe,stroke:#333,stroke-width:2px;
    classDef client fill:#fde047,stroke:#333,stroke-width:2px;
    classDef util fill:#a7f3d0,stroke:#333,stroke-width:2px;
    classDef report fill:#fca5a5,stroke:#333,stroke-width:2px;
    classDef artifact fill:#c4b5fd,stroke:#333,stroke-width:2px;
    classDef external fill:#d1fae5,stroke:#333,stroke-width:2px;
    classDef doc fill:#e0e7ff,stroke:#333,stroke-width:2px;
```
