# deepika5reddy/java-restassured architecture

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

- Interactive diagram: https://gitdiagram.com/deepika5reddy/java-restassured
- Repository: https://github.com/deepika5reddy/java-restassured

## Overview

##### Project Type and Purpose
- This is a Java-based REST API test automation framework. It uses Maven for build/dependency management, TestNG as the test runner, and RestAssured to issue HTTP requests and assert API responses.  Its purpose is to organize and execute automated API test cases (GET calls in the current scope) and integrate seamlessly into CI/CD pipelines (e.g., Jenkins).

##### File Structure Analysis
- Top level
- pom.xml: Maven project descriptor (dependencies, build plugins).
- Jenkinsfile: Defines the CI pipeline steps.
- README.md: Documents how to build and run tests.
- config.properties: Global test configuration.
- src/main/java
- core/: Shared constants/enums (e.g., StatusCode).
- utils/: Utility classes for reading JSON (JsonReader), properties (PropertyReader), and soft assertions (SoftAssertionUtil).
- src/test/java
- userManagement/: Test classes for API endpoints (getUsers.java, getPostmanEcho.java).
- Basics/: Example test cases (reverse string, etc.)—likely sample/experimental tests.
- resources
- TestData/testdata.json: External test data file.
- TestSuites/*.xml: TestNG suite definitions (GroupSuite, SmokeSuite).

##### Key Components
a. Source Code Repository (GitHub)
- Contains pom.xml, source, resources, Jenkinsfile.
b. Developer Environment (IDE + Git + Maven CLI)
- Checkout, code edit, mvn clean test locally.
c. Build & CI Server (Jenkins)
- Pulls code, runs Maven build, triggers TestNG suites.
d. Build Tool (Maven)
- Resolves dependencies (RestAssured, TestNG), compiles code, executes tests.
e. Test Runner (TestNG)
- Reads suite XMLs, instantiates test classes under src/test/java.
f. Core & Utility Modules
- core.StatusCode, utils.JsonReader, utils.PropertyReader, utils.SoftAssertionUtil.
g. Test Scripts
- userManagement.getUsers, userManagement.getPostmanEcho (issue HTTP GETs via RestAssured).
h. Test Data & Configuration
- config.properties; TestData/testdata.json; suite XML files.
i. External API Under Test
- Third-party or internal REST endpoints (e.g., /users, echo endpoints).
j. Test Reports & Logs
- TestNG HTML/XML reports; JUnit XML for Jenkins.

##### Relationships and Data Flows
- Developer → Git push → Jenkins
- Jenkins → mvn clean test → Maven
- Maven → compile src/main/java & src/test/java → produce test runner artifacts
- TestNG → read test suite XML → invoke Test Classes
- Test Classes → call RestAssured → send HTTP requests to External API
- Responses → validated using StatusCode enum + SoftAssertionUtil → results collected
- TestNG → generate reports → Jenkins archive/publish

##### Architectural Patterns & Principles
- Layered structure:
- Configuration layer (config.properties, suite XMLs)
- Utility layer (JsonReader, PropertyReader, SoftAssertionUtil)
- Core definitions (StatusCode)
- Test layer (TestNG test classes)
- Separation of concerns: Test definitions do not manage JSON parsing or property loading directly—they delegate to util classes.
- CI/CD readiness: Jenkinsfile codifies build and test steps.
- Extensibility points:
- More HTTP methods by creating new test classes under packages.
- Custom reporters or listeners via TestNG plugin configuration in pom.xml.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Developer["Developer (IDE + Git + Maven CLI)"]:::dev
    Repo["Git Repository"]:::repo
    Jenkins["Jenkins CI Server"]:::ci
    Maven["Maven"]:::tool
    CompileArtifacts["Compiled Code"]:::artifact
    RestAssured["RestAssured Library"]:::lib
    TestNGRunner["TestNG Runner"]:::tool
    Reports["Test Reports"]:::report
    ExternalAPI["External API Under Test"]:::external

    Developer -->|"push code"| Repo
    Repo -->|"webhook trigger"| Jenkins
    Jenkins -->|"mvn clean test"| Maven
    Maven -->|"compiles"| CompileArtifacts
    Maven -->|"resolves deps"| RestAssured
    CompileArtifacts -->|"runs"| TestNGRunner

    TestNGRunner -->|"reads"| SuiteGroup
    TestNGRunner -->|"reads"| SuiteSmoke
    TestNGRunner -->|"invokes"| GMGetUsers
    TestNGRunner -->|"invokes"| GMEcho
    TestNGRunner -->|"invokes"| ReverseString
    TestNGRunner -->|"invokes"| ReverseWords
    TestNGRunner -->|"invokes"| StringPractice
    TestNGRunner -->|"generates reports"| Reports
    Jenkins -->|"archives"| Reports

    GMGetUsers -->|"issues GET"| ExternalAPI
    GMEcho -->|"issues GET"| ExternalAPI

    GMGetUsers -->|"uses"| JsonReader
    GMEcho -->|"uses"| JsonReader
    GMGetUsers -->|"uses"| PropertyReader
    GMEcho -->|"uses"| PropertyReader
    GMGetUsers -->|"uses"| SoftAssert
    GMEcho -->|"uses"| SoftAssert
    GMGetUsers -->|"validates with"| StatusCode
    GMEcho -->|"validates with"| StatusCode

    ReverseString -->|"sample test"| PropertyReader
    ReverseWords -->|"sample test"| PropertyReader
    StringPractice -->|"sample test"| PropertyReader

    GMGetUsers -->|"reads data"| TestData
    GMEcho -->|"reads data"| TestData
    GMGetUsers -->|"reads config"| ConfigFile
    GMEcho -->|"reads config"| ConfigFile

    subgraph "Repository Files"
        POM["pom.xml"]:::artifact
        Jenkinsfile["Jenkinsfile"]:::tool
        README["README.md"]:::artifact
        ConfigFile["config.properties"]:::config
    end

    subgraph "Test Suite Definitions"
        SuiteGroup["GroupSuite.xml"]:::config
        SuiteSmoke["SmokeSuite.xml"]:::config
    end

    subgraph "Test Data & Config"
        TestData["testdata.json"]:::data
        ConfigFile
    end

    subgraph "Core & Utils"
        StatusCode["StatusCode"]:::core
        JsonReader["JsonReader"]:::util
        PropertyReader["PropertyReader"]:::util
        SoftAssert["SoftAssertionUtil"]:::util
    end

    subgraph "Test Classes"
        GMGetUsers["getUsers"]:::test
        GMEcho["getPostmanEcho"]:::test
        ReverseString["ReverseString"]:::test
        ReverseWords["ReverseWordsInSentence"]:::test
        StringPractice["StringPractice"]:::test
    end

    click Repo "https://github.com/deepika5reddy/java-restassured/tree/main//"
    click POM "https://github.com/deepika5reddy/java-restassured/blob/main//pom.xml"
    click Jenkinsfile "https://github.com/deepika5reddy/java-restassured/tree/main//Jenkinsfile"
    click README "https://github.com/deepika5reddy/java-restassured/blob/main//README.md"
    click ConfigFile "https://github.com/deepika5reddy/java-restassured/blob/main//config.properties"
    click SuiteGroup "https://github.com/deepika5reddy/java-restassured/blob/main//resources/TestSuites/GroupSuite.xml"
    click SuiteSmoke "https://github.com/deepika5reddy/java-restassured/blob/main//resources/TestSuites/SmokeSuite.xml"
    click TestData "https://github.com/deepika5reddy/java-restassured/blob/main//resources/TestData/testdata.json"
    click StatusCode "https://github.com/deepika5reddy/java-restassured/blob/main//src/main/java/core/StatusCode.java"
    click JsonReader "https://github.com/deepika5reddy/java-restassured/blob/main//src/main/java/utils/JsonReader.java"
    click PropertyReader "https://github.com/deepika5reddy/java-restassured/blob/main//src/main/java/utils/PropertyReader.java"
    click SoftAssert "https://github.com/deepika5reddy/java-restassured/blob/main//src/main/java/utils/SoftAssertionUtil.java"
    click GMGetUsers "https://github.com/deepika5reddy/java-restassured/blob/main//src/test/java/userManagement/getUsers.java"
    click GMEcho "https://github.com/deepika5reddy/java-restassured/blob/main//src/test/java/userManagement/getPostmanEcho.java"
    click ReverseString "https://github.com/deepika5reddy/java-restassured/blob/main//src/test/java/Basics/ReverseString.java"
    click ReverseWords "https://github.com/deepika5reddy/java-restassured/blob/main//src/test/java/Basics/ReverseWordsInSentence.java"
    click StringPractice "https://github.com/deepika5reddy/java-restassured/blob/main//src/test/java/Basics/StringPractice.java"

    classDef dev fill:#D6E9FF,stroke:#000
    classDef repo fill:#B3CDE0,stroke:#000
    classDef ci fill:#CBE6CB,stroke:#000
    classDef tool fill:#CBE6CB,stroke:#000
    classDef lib fill:#DFF2D8,stroke:#000
    classDef artifact fill:#ECECEC,stroke:#000
    classDef config fill:#F0F0F0,stroke:#000
    classDef data fill:#E8E8E8,stroke:#000
    classDef core fill:#B3CDE0,stroke:#000
    classDef util fill:#B3CDE0,stroke:#000
    classDef test fill:#DECBE4,stroke:#000
    classDef external fill:#FDD49E,stroke:#000
    classDef report fill:#EFE1C6,stroke:#000
```
