# thangarajtk/restassured-api-automation architecture

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

- Interactive diagram: https://gitdiagram.com/thangarajtk/restassured-api-automation
- Repository: https://github.com/thangarajtk/restassured-api-automation

## Overview

##### Project type and purpose
- This is an API automation framework written in Java using Maven and TestNG.
- It uses Rest Assured (Groovy under the hood) to test RESTful services (GET, POST, PUT, PATCH, DELETE, etc.).
- It also integrates with JSON-Server, WireMock, Excel, Faker, Jira, and ExtentReports to facilitate end-to-end API testing, data-driven tests, mocking, and reporting.

##### File structure
- Top-level: Maven pom.xml, DockerFile, Checkstyle configs, a packaged JAR (jobportal-0.0.1-SNAPSHOT.jar) for the demo server, db.json for JSON-Server.
- src/main/java/com/automation:
- annotations, config, constants, enums, exceptions, listeners, models (builders & POJOs), reports, utils.
- FrameworkAnnotation.java marks custom annotations; ConfigFactory/FrameworkConfig load properties; ApiUtils wraps Rest Assured calls; ExtentManager/ExtentLogger manage HTML report; FakerUtils, ExcelUtils, JiraUtils, PropertyUtils, RandomUtils support test data & environment.
- src/test/java/com/automation:
- practice: exploratory tests against public APIs (reqres.in, ergast, JSON-Server, Postman Echo, WireMock).
- tests: core regression tests (job portal CRUD).
- src/test/resources: test data (Excel, JSON schemas, mock mappings), config.properties, WireMock standalone jar, log4j2.properties, TestNG suite (testng.xml).

##### README for additional insights
- Confirms quick start prerequisites: Java, IntelliJ, Maven, TestNG.
- Describes how to spin up JSON-Server (db.json) and the demo jobportal JAR.
- Mentions external URIs (reqres.in, ergast.com) and schema validation steps.
- Details WireMock usage and Docker build/push steps for the framework.

a. Main components:
1. Test Runner (TestNG + testng.xml)
2. Framework Core
- Configuration Module (ConfigFactory, FrameworkConfig, PropertyHelper)
- Request/Response Builders (RequestBuilder, ResponseBuilder)
- Utility Module (ApiUtils, FakerUtils, ExcelUtils, JiraUtils, AssertionUtils)
- Reporting Module (ExtentManager, ExtentLogger)
- Listeners & Retry Logic (Listeners, RetryFailedTests)
3. Test Suites
- practice/*
- tests/*
4. System-Under-Test (SUT)
- Local JSON-Server (db.json → http://localhost:3000)
- Demo JobPortal Spring Boot App (jobportal-…jar → localhost:5050)
- External REST APIs (reqres.in, ergast.com)
- WireMock Mock Server (standalone JAR + mappings)
5. Test Data & Artifacts
- Excel files, JSON schemas, XML schemas
- WireMock mappings & __files
6. CI/Docker
- DockerFile for packaging the test framework container
- pom.xml for build, checkstyle for code style
b. Relationships & interactions:
- Test Runner loads TestNG suite → invokes test classes → test methods call ApiUtils/RequestBuilder to formulate HTTP requests.
- ConfigModule reads config.properties → provides baseURL, authentication, ports.
- HTTP calls go to SUT: either local JSON-Server, JobPortal App, external APIs, or WireMock.
- Responses are passed to ResponseBuilder & AssertionUtils for validation (JSON/XML schema, status codes).
- Data-driven tests use ExcelUtils and FakerUtils for dynamic test data.
- JiraUtils can file bugs based on test outcomes.
- Listeners capture test events, trigger RetryFailedTests, and feed events to ExtentManager to produce HTML reports.
c. Architectural patterns:
- Layered pattern:
- Configuration → Request/Response Builders → API Execution → Assertions → Reporting
- Builder pattern for constructing requests and responses.
- Factory pattern in ConfigFactory.
- Singleton pattern in ExtentManager and constants (FCWithSingleton).
- Observer pattern via TestNG Listeners.
d. Key technologies:
- Java 11+, Maven, TestNG, Rest Assured (Groovy), WireMock, JSON-Server (node), ExtentReports, Apache POI (ExcelUtils), Faker, Jira API, Log4j2.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Runner
    TR["TestNG Runner\n(testng.xml)"]:::tests

    %% Framework Core
    subgraph "Framework Core"
        direction TB
        CM["ConfigModule"]:::core
        RB["RequestBuilder"]:::core
        RespB["ResponseBuilder"]:::core
        UM["UtilityModule"]:::core
        RM["ReportingModule"]:::core
        LR["Listeners & RetryLogic"]:::core
        AA["Annotations & Exceptions"]:::core
        EC["Enums & Constants"]:::core
    end

    %% Test Suites
    subgraph "Test Suites"
        direction TB
        PS["Practice Tests"]:::tests
        RS["Regression Tests"]:::tests
    end

    %% System Under Test
    subgraph "System Under Test"
        direction TB
        JS["JSON-Server\n(db.json)"]:::sut
        JP["JobPortal App\n(jar)"]:::sut
        EA["External APIs"]:::sut
        WM["WireMock Server"]:::sut
    end

    %% Test Data & Artifacts
    subgraph "Test Data & Artifacts"
        direction TB
        EXF["Excel Files"]:::data
        JSONS["JSON Schemas"]:::data
        XMLS["XML Schemas"]:::data
        CONF["config.properties"]:::data
        WMmap["WireMock Mappings & __files"]:::data
    end

    %% CI & Containerization
    subgraph "CI & Containerization"
        direction TB
        DF["DockerFile"]:::ci
        POM["pom.xml"]:::ci
        CS["Checkstyle Configs"]:::ci
    end

    %% Flow
    TR -->|"loads suite"| PS
    TR -->|"loads suite"| RS
    PS -->|"invoke tests"| UM
    RS -->|"invoke tests"| UM

    UM -->|"reads config"| CM
    CM -->|"provides baseURL"| UM

    UM -->|"builds request"| RB
    RB -->|"calls API"| RespB
    RespB -->|"validates response"| UM

    UM -->|"assertions"| UM
    
    UM -->|"logs & reports"| RM
    LR -->|"captures events"| RM

    UM -->|"on failure"| LR
    AA --> UM
    EC --> UM

    UM -->|"files bugs"| UM

    UM -->|"sends HTTP"| JS
    UM -->|"sends HTTP"| JP
    UM -->|"sends HTTP"| EA
    UM -->|"sends HTTP"| WM

    EXF --> UM
    JSONS --> UM
    XMLS --> UM
    CONF --> CM
    WMmap --> WM

    DF --> TR
    POM --> TR
    CS --> TR

    %% Click Events
    click TR "https://github.com/thangarajtk/restassured-api-automation/blob/master/testng.xml"
    click CM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/config/ConfigFactory.java"
    click CM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/config/FrameworkConfig.java"
    click CM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/PropertyHelper.java"
    click CM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/PropertyUtils.java"
    click CM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/constants/FrameworkConstants.java"
    click RB "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/models/builders/RequestBuilder.java"
    click RespB "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/models/builders/ResponseBuilder.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/ApiUtils.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/AssertionUtils.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/AssertionKeys.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/ExcelUtils.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/FakerUtils.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/JiraUtils.java"
    click UM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/utils/RandomUtils.java"
    click RM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/reports/ExtentManager.java"
    click RM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/reports/ExtentLogger.java"
    click RM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/reports/ExtentReport.java"
    click LR "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/listeners/Listeners.java"
    click LR "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/listeners/RetryFailedTests.java"
    click AA "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/annotations/FrameworkAnnotation.java"
    click AA "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/exceptions/FrameworkException.java"
    click AA "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/exceptions/ReportInitializationException.java"
    click EC "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/enums/ConfigProperties.java"
    click EC "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/enums/CategoryType.java"
    click EC "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/enums/Authors.java"
    click EC "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/main/java/com/automation/constants/FCWithSingleton.java"
    click PS "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/java/com/automation/practice"
    click RS "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/java/com/automation/tests"
    click JS "https://github.com/thangarajtk/restassured-api-automation/blob/master/db.json"
    click JP "https://github.com/thangarajtk/restassured-api-automation/blob/master/jobportal-0.0.1-SNAPSHOT.jar"
    click WM "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/test/resources/wiremock/wiremock-jre8-standalone-2.33.1.jar"
    click WMmap "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/resources/wiremock/mappings"
    click WMmap "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/resources/wiremock/__files"
    click EXF "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/resources/data"
    click JSONS "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/resources/json"
    click XMLS "https://github.com/thangarajtk/restassured-api-automation/tree/master/src/test/resources/xml"
    click CONF "https://github.com/thangarajtk/restassured-api-automation/blob/master/src/test/resources/config/config.properties"
    click DF "https://github.com/thangarajtk/restassured-api-automation/tree/master/DockerFile"
    click POM "https://github.com/thangarajtk/restassured-api-automation/blob/master/pom.xml"
    click CS "https://github.com/thangarajtk/restassured-api-automation/blob/master/checkstyle/checkstyle.xml"
    click CS "https://github.com/thangarajtk/restassured-api-automation/blob/master/checkstyle/checkstyle-suppressions.xml"

    %% Styles
    classDef core fill:#D0E8FF,stroke:#0366D6,color:#0366D6
    classDef tests fill:#E6FFFA,stroke:#059669,color:#065F46
    classDef sut fill:#FFF4E6,stroke:#DD6B20,color:#A65100
    classDef data fill:#FEF9C3,stroke:#D97706,color:#92400E
    classDef ci fill:#F3E8FF,stroke:#8B5CF6,color:#582C83
```
