# heyrmi/api-testing-framework architecture

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

- Interactive diagram: https://gitdiagram.com/heyrmi/api-testing-framework
- Repository: https://github.com/heyrmi/api-testing-framework

## Overview

##### Project type and purpose
- This is a full-stack automated API-testing framework written in Java.
- Core functions:
– Functional API tests using Rest-Assured & TestNG
– Load tests using Gatling
– Report generation via ExtentReports
– CI/CD integration (GitHub Actions, Docker)
– Slack notifications, GitHub Pages hosting of reports

##### File structure
- Top-level artifacts:
– Dockerfile, pom.xml, testng.xml, .github/workflows, Reports directory
- src/main/java/com/apitesting:
– annotation, constants, enums, listeners, pojo, reports, requestbuilder, utils
- src/test/java/com/apitesting/tests & com.gatling/tests:
– TestNG functional tests (GetTests, PostTests)
– Gatling load-test simulations (GoogleTest, VideoGameDBTest)
- src/test/resources:
– JSON payload templates, config.properties, gatling.conf

##### Extract architecture clues from README
- Tech stack: Rest-Assured, Gatling, Postman, TestNG, ExtentReports, Java Faker
- CI/CD: GitHub Actions workflows for tests, alerts, Docker image build & push
- Reporting: Slack integration and hosting HTML report via GitHub Pages

##### Main components
a. Test Runner Layer
– TestNG engine invoking functional tests
– Gatling engine invoking load tests
b. Test Code & Libraries
– RequestBuilder & APIUtils (Rest-Assured)
– Data models (pojo/User) & JSON templates
– Utility classes (PropertyUtils, JiraUtils, RandomUtils)
– FrameworkAnnotation & TestListener (hooks, retry logic, reporting events)
c. Reporting & Notification
– ExtentManager, ExtentLogger, ExtentReport producing HTML reports
– Slack (external service) receiving alerts via JiraUtils or webhook
– GitHub Pages hosting latest report
d. CI/CD & Deployment
– GitHub Actions workflows (tests.yml, builddockerimage.yml, alerts.yml)
– Dockerfile packaging framework into container
– DockerHub for publishing image
e. External Systems
– Target APIs under test (e.g., VideoGameDB, Google)
– Slack webhook endpoint

##### Relationships & data flow
- TestNG/Gatling runner → requestbuilder builds HTTP requests → APIUtils executes calls via Rest-Assured or Gatling client → responses parsed into POJOs
- TestListener captures pass/fail events → ExtentLogger logs steps → ExtentReport writes HTML → Reports folder
- At end of run → SlackUtils sends summary message
- GitHub Actions triggers on push/PR → runs tests and build workflows → pushes Docker image → publishes reports to GitHub Pages

##### Architectural patterns & principles
- Modular design: separation of concerns (builders, utils, models, listeners)
- Singleton pattern for ExtentManager and configuration reads
- Annotation-driven test metadata (FrameworkAnnotation)
- CI pipeline as code (GitHub Actions YAML)
- Containerization for environment consistency

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD & Deployment Layer
    subgraph "CI/CD & Deployment"
        direction TB
        TestsYML["Function & Load Test Execution (tests.yml)"]:::cicd
        BuildDockerYML["Docker Image Build & Push (builddockerimage.yml)"]:::cicd
        AlertsYML["Alerts & Notifications (alerts.yml)"]:::cicd
        PRTestYML["Pull-Request Test Workflow (prtest.yml)"]:::cicd
        DockerfileNode["Dockerfile"]:::cicd
        DockerHub["DockerHub"]:::external
    end

    %% Container wrapping
    subgraph "Docker Container" 
        direction TB
        %% Test Execution Layer
        subgraph "Test Execution Layer"
            direction TB
            TestNGRunner["TestNG Runner<br/>(testng.xml)"]:::testexec
            FunctionalTests["Functional Tests"]:::testexec
            GatlingEngine["Gatling Engine<br/>(gatling.conf)"]:::testexec
        end

        %% Core Libraries & Helpers
        subgraph "Core Libraries & Helpers"
            direction TB
            RequestBuilder["RequestBuilder"]:::testexec
            APIUtils["APIUtils"]:::testexec
            PropertyUtils["PropertyUtils"]:::testexec
            FrameworkConstants["FrameworkConstants"]:::testexec
            FrameworkConstantsSingleton["FrameworkConstantsWithSingleton"]:::testexec
            RandomUtils["RandomUtils"]:::testexec
            JiraUtils["JiraUtils"]:::testexec
            FrameworkAnnotation["FrameworkAnnotation"]:::testexec
            TestListener["TestListener"]:::testexec
            DataModels["User POJO"]:::testexec
            JSONTemplates["JSON Payload Templates"]:::testexec
        end

        %% Reporting & Notification
        subgraph "Reporting & Notification"
            direction TB
            ExtentManager["ExtentManager"]:::reporting
            ExtentLogger["ExtentLogger"]:::reporting
            ExtentReport["ExtentReport"]:::reporting
            ReportsDir["Reports Directory"]:::reporting
            SlackNode["Slack Webhook"]:::external
            GitHubPages["GitHub Pages"]:::external
        end
    end

    %% External APIs Under Test
    subgraph "External Systems"
        direction TB
        VideoGameDBAPI["VideoGameDB API"]:::external
        GoogleAPI["Google API"]:::external
    end

    %% Connections
    TestsYML -->|"triggers"| DockerfileNode
    PRTestYML -->|"triggers"| DockerfileNode
    BuildDockerYML -->|"build & push image to"| DockerHub
    AlertsYML -->|"sends alerts via"| SlackNode

    DockerfileNode -->|"runs container"| TestNGRunner
    DockerrunTestNG[TestNG Runner] -.->|uses| FunctionalTests
    TestNGRunner -->|"loads config"| PropertyUtils
    TestNGRunner -->|"reads annotations"| FrameworkAnnotation
    TestNGRunner -->|"registers listener"| TestListener
    FunctionalTests -->|"execute tests via"| RequestBuilder
    GatlingEngine -->|"simulate load via"| RequestBuilder

    RequestBuilder -->|"builds HTTP requests"| APIUtils
    APIUtils -->|"calls"| VideoGameDBAPI
    APIUtils -->|"calls"| GoogleAPI
    APIUtils -->|"parses responses to"| DataModels

    TestListener -->|"captures events"| ExtentLogger
    ExtentLogger -->|"logs to"| ExtentManager
    ExtentManager -->|"generates HTML"| ExtentReport
    ExtentReport -->|"writes to"| ReportsDir

    TestsYML -->|"after run"| ReportsDir
    ReportsDir -->|"published to"| GitHubPages
    TestListener -->|"on finish"| JiraUtils
    JiraUtils -->|"posts summary to"| SlackNode

    %% Class Definitions
    classDef testexec fill:#CCE5FF,stroke:#1E90FF,color:#000
    classDef reporting fill:#D4EDDA,stroke:#28A745,color:#000
    classDef cicd fill:#FFF3CD,stroke:#FFC107,color:#000
    classDef external fill:#E2E3E5,stroke:#6C757D,color:#000

    %% Click Events
    click TestNGRunner "https://github.com/heyrmi/api-testing-framework/blob/master/testng.xml"
    click FunctionalTests "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/java/com/apitesting/tests/GetTests.java"
    click FunctionalTests "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/java/com/apitesting/tests/PostTests.java"
    click FunctionalTests "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/java/com/apitesting/tests/BaseTest.java"
    click GatlingEngine "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/java/com/gatling/tests/GoogleTest.java"
    click GatlingEngine "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/java/com/gatling/tests/VideoGameDBTest.java"
    click GatlingEngine "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/resources/gatling.conf"
    click RequestBuilder "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/requestbuilder/RequestBuilder.java"
    click APIUtils "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/utils/APIUtils.java"
    click DataModels "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/pojo/User.java"
    click JSONTemplates "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/resources/JSON/request.json"
    click JSONTemplates "https://github.com/heyrmi/api-testing-framework/blob/master/src/test/resources/JSON/jiraIssueRequest.json"
    click PropertyUtils "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/utils/PropertyUtils.java"
    click FrameworkConstants "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/constants/FrameworkConstants.java"
    click FrameworkConstantsSingleton "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/constants/FrameworkConstantsWithSingleton.java"
    click RandomUtils "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/utils/RandomUtils.java"
    click JiraUtils "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/utils/JiraUtils.java"
    click FrameworkAnnotation "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/annotation/FrameworkAnnotation.java"
    click TestListener "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/listeners/TestListener.java"
    click ExtentManager "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/reports/ExtentManager.java"
    click ExtentLogger "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/reports/ExtentLogger.java"
    click ExtentReport "https://github.com/heyrmi/api-testing-framework/blob/master/src/main/java/com/apitesting/reports/ExtentReport.java"
    click ReportsDir "https://github.com/heyrmi/api-testing-framework/tree/master/Reports/"
    click TestsYML "https://github.com/heyrmi/api-testing-framework/blob/master/.github/workflows/tests.yml"
    click BuildDockerYML "https://github.com/heyrmi/api-testing-framework/blob/master/.github/workflows/builddockerimage.yml"
    click AlertsYML "https://github.com/heyrmi/api-testing-framework/blob/master/.github/workflows/alerts.yml"
    click PRTestYML "https://github.com/heyrmi/api-testing-framework/blob/master/.github/workflows/prtest.yml"
    click DockerfileNode "https://github.com/heyrmi/api-testing-framework/tree/master/Dockerfile"
```
