# ch-akash/rest-assured-testng-framework architecture

> Architecture diagram of the GitHub repository ch-akash/rest-assured-testng-framework, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ch-akash/rest-assured-testng-framework
- Repository: https://github.com/ch-akash/rest-assured-testng-framework

## Overview

##### Project type and purpose
- This is an API test-automation framework (not a user-facing service), built in Java with Maven, TestNG, and RestAssured.
- Its goal is to drive HTTP calls against a REST booking service, validate responses, and produce Allure reports.

##### File structure
- src/main/java/apis: encapsulates each endpoint (CreateBookingApi, GetBookingApi, etc.).
- src/main/java/http: BaseApi implements shared HTTP logic.
- src/main/java/config: loads properties (API base URL, credentials).
- src/main/java/constants: centralizes API path constants.
- src/main/java/pojo: request/response models.
- src/main/java/util: helpers for building requests and test data.
- src/main/java/listeners: TestNG listeners—AnnotationTransformer, RetryAnalyzer.
- src/test/java: TestNG test classes invoking the API classes.
- Root and CI files: Dockerfile, Jenkinsfile, GitHub workflows, pom.xml, suite XMLs.

##### Key insights from README
- TestNG drives test execution; RestAssured does HTTP/JSON; Maven orchestrates build/deps; Allure is the report engine.
- Two suite entry points: crud-tests.xml (CRUD) and suite.xml (full suite).

##### Main components
a. Test Runner Layer
- TestNG core engine
- suite XMLs (crud-tests.xml, suite.xml)
b. Test Layer
- Test classes (CRUDTests, CreateBookingApiTests, etc.)
c. API Abstraction Layer
- apis package (CreateBookingApi, GetBookingApi, UpdateBookingApi, DeleteBookingApi)
- http.BaseApi (handles HTTP setup, common headers, authentication)
- constants.ApiPaths
- util.ApiRequestHelper & TestDataHelper
d. Data Model Layer
- pojo.request (BookingDates, CreateBookingRequest)
- pojo.response (Booking, CreateBookingResponse)
e. Configuration Layer
- config.PropertyConfig & PropertyUtil reading config.properties
f. Reporting & Listeners
- listeners.AnnotationTransformer & RetryAnalyzer
- Allure TestNG listener (via pom.xml)
g. External Systems & Tools
- System under test (Booking REST API)
- CI/CD (GitHub Actions, Jenkins)
- Docker container environment
- Allure CLI for report serving

##### Relationships and interactions
- TestNG Runner reads suite XML → instantiates Test classes.
- Test classes call into API Abstraction Layer.
- API classes use PropertyConfig to fetch base-URL and credentials.
- BaseApi + RestAssured execute HTTP request against SUT.
- Responses are deserialized into POJOs.
- Test assertions compare POJOs to expectations (using TestDataHelper).
- Listeners hook into TestNG events for retry logic and annotation transformation.
- TestNG Allure listener collects test steps and results → Allure generates HTML/JSON.
- CI pipelines kick off mvn test, build Docker image, run tests, publish Allure reports.

##### Architectural patterns and design principles
- Layered architecture: separation of concerns (Tests, API clients, config, data models).
- Page-object-like pattern for REST endpoints (one class per endpoint).
- Centralized configuration and constants to avoid magic strings.
- Utility classes for reusability (request building, test data).
- TestNG listener pattern for cross-cutting concerns (retry, dynamic annotations).

## Diagram (Mermaid)

```mermaid
flowchart TD
    runner["TestNG Engine"]:::framework
    maven["Maven"]:::framework

    subgraph "Test Suite"
        direction TB
        Suites1["crud-tests.xml"]:::tests
        Suites2["suite.xml"]:::tests
        bt["BaseTest"]:::tests
        ct1["CRUDTests"]:::tests
        ct2["CreateBookingApiTests"]:::tests
        ct3["GetBookingApiTests"]:::tests
        ct4["UpdateBookingApiTests"]:::tests
        ct5["DeleteBookingApiTests"]:::tests
        ct6["AwaitilityTests"]:::tests
    end

    subgraph "Core Framework"
        direction TB
        subgraph "API Abstraction"
            direction TB
            api1["CreateBookingApi"]:::framework
            api2["GetBookingApi"]:::framework
            api3["UpdateBookingApi"]:::framework
            api4["DeleteBookingApi"]:::framework
            baseApi["BaseApi"]:::framework
            apiConst["ApiPaths"]:::framework
            reqUtil["ApiRequestHelper"]:::framework
            dataUtil["TestDataHelper"]:::framework
        end
        subgraph "Data Models"
            direction TB
            rd1["BookingDates"]:::framework
            rd2["CreateBookingRequest"]:::framework
            rs1["Booking"]:::framework
            rs2["CreateBookingResponse"]:::framework
        end
        subgraph "Configuration"
            direction TB
            pc["PropertyConfig"]:::framework
            pu["PropertyUtil"]:::framework
            cfgFile["config.properties"]:::framework
        end
    end

    subgraph "Reporting & Listeners"
        direction TB
        lt1["AnnotationTransformer"]:::framework
        lt2["RetryAnalyzer"]:::framework
        allurePom["pom.xml"]:::framework
    end

    subgraph "CI/CD & Environment"
        direction TB
        df["Dockerfile"]:::external
        jf["Jenkinsfile"]:::external
        gha["rest-assured.yml"]:::external
        ciPom["pom.xml"]:::framework
    end

    sut["Booking REST API"]:::external
    allureCLI["Allure CLI/UI"]:::external

    maven --> runner
    runner --> Suites1
    runner --> Suites2
    runner --> lt1
    runner --> lt2
    runner --> allurePom

    Suites1 --> bt
    Suites2 --> bt
    bt --> ct1
    bt --> ct2
    bt --> ct3
    bt --> ct4
    bt --> ct5
    bt --> ct6

    ct1 -->|"calls"| api1
    ct2 -->|"calls"| api1
    ct3 -->|"calls"| api2
    ct4 -->|"calls"| api3
    ct5 -->|"calls"| api4
    ct6 -->|"calls"| baseApi

    api1 --> baseApi
    api2 --> baseApi
    api3 --> baseApi
    api4 --> baseApi

    api1 --> apiConst
    api2 --> apiConst
    api3 --> apiConst
    api4 --> apiConst

    api1 --> reqUtil
    api1 --> dataUtil
    api2 --> reqUtil
    api2 --> dataUtil
    api3 --> reqUtil
    api3 --> dataUtil
    api4 --> reqUtil
    api4 --> dataUtil

    api1 --> rd1
    api1 --> rd2

    baseApi --> rs1
    baseApi --> rs2

    baseApi --> pc
    pc --> pu
    pu --> cfgFile

    baseApi --> sut

    allurePom --> allureCLI

    df --> ciPom
    jf --> ciPom
    gha --> ciPom
    ciPom --> maven

    classDef framework fill:#AEDBFF,stroke:#333,stroke-width:1px;
    classDef tests fill:#C8FACC,stroke:#333,stroke-width:1px;
    classDef external fill:#FFD8A8,stroke:#333,stroke-width:1px;

    click Suites1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/crud-tests.xml"
    click Suites2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/suite.xml"
    click bt "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/BaseTest.java"
    click ct1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/CRUDTests.java"
    click ct2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/CreateBookingApiTests.java"
    click ct3 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/GetBookingApiTests.java"
    click ct4 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/UpdateBookingApiTests.java"
    click ct5 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/DeleteBookingApiTests.java"
    click ct6 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/test/java/AwaitilityTests.java"
    click api1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/apis/CreateBookingApi.java"
    click api2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/apis/GetBookingApi.java"
    click api3 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/apis/UpdateBookingApi.java"
    click api4 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/apis/DeleteBookingApi.java"
    click baseApi "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/http/BaseApi.java"
    click apiConst "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/constants/ApiPaths.java"
    click reqUtil "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/util/ApiRequestHelper.java"
    click dataUtil "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/util/TestDataHelper.java"
    click rd1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/pojo/request/BookingDates.java"
    click rd2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/pojo/request/CreateBookingRequest.java"
    click rs1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/pojo/response/Booking.java"
    click rs2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/pojo/response/CreateBookingResponse.java"
    click pc "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/config/PropertyConfig.java"
    click pu "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/config/PropertyUtil.java"
    click cfgFile "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/resources/config.properties"
    click lt1 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/listeners/AnnotationTransformer.java"
    click lt2 "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/src/main/java/listeners/RetryAnalyzer.java"
    click allurePom "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/pom.xml"
    click df "https://github.com/ch-akash/rest-assured-testng-framework/tree/main/Dockerfile"
    click jf "https://github.com/ch-akash/rest-assured-testng-framework/tree/main/Jenkinsfile"
    click gha "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/.github/workflows/rest-assured.yml"
    click ciPom "https://github.com/ch-akash/rest-assured-testng-framework/blob/main/pom.xml"
```
