# pavleciric89/ui-api-test-automation-framework architecture

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

- Interactive diagram: https://gitdiagram.com/pavleciric89/ui-api-test-automation-framework
- Repository: https://github.com/pavleciric89/ui-api-test-automation-framework

## Overview

##### Project type and purpose
- This is a Java-based UI and API test automation framework built with Maven, Cucumber BDD, TestNG, Selenium WebDriver and REST-Assured.
- It orchestrates end-to-end UI tests (via page objects and Selenium) and API tests (via REST-Assured), then collates results into HTML reports.

##### File structure
- Top-level Maven project: pom.xml, src/main/java for reusable libraries (ApiUtils, pageObjects, utils), src/main/resources for configuration (config.properties).
- src/test/java contains the BDD test suite: feature files (src/test/resources/featureFiles), Cucumber step definitions (stepDefs), and the TestNG/Cucumber runner (MainRunner).
- Utilities: DriverFactory for WebDriver management; ReadConfigFile for loading endpoints, credentials.
- Build and execution artifacts: run.bat invokes the tests locally; target/ holds compiled classes, the JAR, and generated reports (cucumber-html-report, test-output).

##### README for additional insights
- Confirms exact tech stack and local execution entrypoint (run.bat → HTML report).

a. Main components
– Test Runner layer: Cucumber CLI + TestNG
– Feature Files (Gherkin)
– Glue Code: Step Definitions (UI_Steps, API_Steps, Hooks)
– Implementation libraries:
- UI Module: pageObjects + DriverFactory + Selenium WebDriver
- API Module: ApiUtils + REST-Assured
- Config Module: ReadConfigFile + config.properties
– External Systems Under Test:
- Web Application (UI endpoints)
- REST API endpoints
– Reporting:
- Cucumber HTML Reporter
- TestNG default reports
– Build & CI:
- Maven (pom.xml)
- Local runner (run.bat)
b. Relationships and interactions
1. run.bat → triggers “mvn test” → Cucumber/TestNG execution
2. Test Runner reads Feature Files → maps to Step Definitions
3. Step Definitions invoke either:
- UI Module → DriverFactory spins up WebDriver → interacts with Web Application via pageObjects
- API Module → REST-Assured calls API endpoints
4. Both modules log results back to TestNG/Cucumber engine
5. Reporting plugins generate HTML in target/cucumber-html-report and test-output
c. Architectural patterns
- BDD (Behavior-Driven Development) using Cucumber
- Page Object Model for UI abstraction
- Layered design (Feature → Steps → Implementation → External systems)
- Utility classes centralize driver and configuration management
d. Key technologies & libraries
- Java 8+
- Maven
- Cucumber BDD
- TestNG
- Selenium WebDriver
- REST-Assured
- HTML reporting plugins

##### Detail without over-splitting
- Every logical module (runner, steps, modules, utils) as its own component.
- Avoid putting every single class; group by package (e.g., pageObjects, ApiUtils).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & CI Layer
    subgraph "Build & CI" 
        runbat["/run.bat/"]:::ci
        pom[(pom.xml)]:::ci
        tng["testng.xml"]:::ci
    end

    runbat -->|"invokes mvn test"| pom
    pom --> TestRunner
    tng --> TestRunner

    %% Test Definitions & Runner Layer
    subgraph "Test Definitions & Runner"
        TestRunner["Test Runner (Cucumber + TestNG)"]:::runner
        FeatureFiles["Feature Files"]:::doc
    end

    FeatureFiles -->|"reads"| TestRunner

    %% Glue Code Layer
    subgraph "Glue Code (Step Definitions)"
        API_Step["API_Step"]:::runner
        UI_Login["UI_LoginStep"]:::runner
        UI_Orders["UI_OrdersStep"]:::runner
        Hooks["Hooks"]:::runner
    end

    TestRunner --> Glue["uses"] 
    Glue --> API_Step
    Glue --> UI_Login
    Glue --> UI_Orders
    Glue --> Hooks

    %% Implementation Libraries Layer
    subgraph "Implementation Libraries"
        subgraph "UI Test Module" 
            PO["Page Objects"]:::impl
            DF["DriverFactory"]:::impl
        end
        subgraph "API Test Module"
            APIConstant["APIConstant"]:::impl
            RestExt["RestAssuredExtension"]:::impl
        end
        subgraph "Configuration Module"
            ReadCfg["ReadConfigFile"]:::impl
            ConfigProps[(config.properties)]:::impl
        end
    end

    API_Step -->|"calls"| APIConstant
    API_Step -->|"calls"| RestExt
    UI_Login -->|"uses"| PO
    UI_Orders -->|"uses"| PO
    Hooks -->|"loads config via"| ReadCfg
    ReadCfg -->|"reads"| ConfigProps

    PO -->|"initializes via"| DF
    DF -->|"drives"| WebApp
    APIConstant -->|"calls"| RestAPI
    RestExt -->|"calls"| RestAPI

    %% External Systems Under Test
    subgraph "External Systems" 
        WebApp["Web Application"]:::external
        RestAPI["REST API Endpoints"]:::external
    end

    %% Reporting Layer
    TestRunner -->|"generates"| ReportHTML["Cucumber HTML Report"]:::report
    TestRunner -->|"generates"| ReportNG["TestNG Reports"]:::report

    %% Click Events
    click TestRunner "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/test/java/runner/MainRunner.java"
    click FeatureFiles "https://github.com/pavleciric89/ui-api-test-automation-framework/tree/master/src/test/resources/featureFiles/"
    click API_Step "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/test/java/stepDefs/API_Step.java"
    click UI_Login "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/test/java/stepDefs/UI_LoginStep.java"
    click UI_Orders "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/test/java/stepDefs/UI_OrdersStep.java"
    click Hooks "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/test/java/stepDefs/Hooks.java"
    click PO "https://github.com/pavleciric89/ui-api-test-automation-framework/tree/master/src/main/java/pageObjects/"
    click DF "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/main/java/utils/DriverFactory.java"
    click APIConstant "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/main/java/ApiUtils/APIConstant.java"
    click RestExt "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/main/java/ApiUtils/RestAssuredExtension.java"
    click ReadCfg "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/main/java/utils/ReadConfigFile.java"
    click ConfigProps "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/src/main/resources/properties/config.properties"
    click pom "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/pom.xml"
    click runbat "https://github.com/pavleciric89/ui-api-test-automation-framework/blob/master/run.bat"
    click ReportHTML "https://github.com/pavleciric89/ui-api-test-automation-framework/tree/master/target/cucumber-html-report/"
    click ReportNG "https://github.com/pavleciric89/ui-api-test-automation-framework/tree/master/test-output/"

    %% Styles
    classDef runner fill:#D0E7FF,stroke:#0366D6,color:#0366D6;
    classDef impl fill:#DFF0D8,stroke:#3C763D,color:#3C763D;
    classDef external fill:#FDEBD0,stroke:#D35400,color:#D35400;
    classDef ci fill:#EBEBEB,stroke:#888888,color:#888888;
    classDef doc fill:#F5E1FD,stroke:#8E44AD,color:#8E44AD;
    classDef report fill:#FDEADA,stroke:#E67E22,color:#E67E22;
```
