# surajsingh3091/nextgenerationautomationframework architecture

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

- Interactive diagram: https://gitdiagram.com/surajsingh3091/nextgenerationautomationframework
- Repository: https://github.com/surajsingh3091/nextgenerationautomationframework

## Overview

##### Project Type and Purpose
- This is a Java-based test automation framework built with Maven, using Cucumber for BDD, Selenium WebDriver for browser automation, and a Page Object Model (POM) structure.
- Purpose: Drive end-to-end UI tests against an application (e.g., OrangeHRM), manage test configuration, logging, and reporting.

##### File Structure Analysis
A. src/main/java/application/PageRepository
- PageInitializer – bootstraps page objects
- PageObjectManager – provides centralized access to page instances
- Pages folder – individual POM classes (Login_Page, Home_Page, AddEmployee_Page, ApplicationMaster_Page)
B. src/main/java/com/nextZen/Framework
- Base
– DriverManager.java (initializes and tears down WebDriver)
- ConfigReaderUtility
– ConfigurationManager.java (singleton reads .properties files)
- ExecutionContext
– ExecutionContext.java (holds test-level context, e.g., WebDriver, test name)
- WebUtility
– SeleniumHelper.java (wrapper methods over Selenium commands)
C. src/main/resources
- Properties/DBConfig.properties (database config)
- log4j2.xml (logging config)
D. src/test/java
- StepDefinition
– CommonStepDefinition.java, StepDefinition.java (Cucumber step definitions)
– TestHooks/CucumberHooks.java (before/after hooks)
- TestRunner/TestRunner.java (JUnit runner for Cucumber)
E. src/test/resources
- Feature files (AddEmployee.feature under OrangeHRM folder)
- TestConfig.properties, extent-config.xml (reporting config)
- TestData folder

##### Key Insights from README
- Minimal information (project title).
- Project name (“NextGenerationAutomationFramework”) confirms it’s a reusable automation framework.

##### Main Components
1. Test Artifacts
– Feature Files (Gherkin)
– Test Data / Properties
2. Test Engine
– TestRunner (JUnit + Cucumber)
– Cucumber Hooks (setup/teardown)
– Step Definitions
3. Framework Core
– ConfigurationManager (reads config files)
– DriverManager (manages WebDriver instances)
– ExecutionContext (holds per-scenario context)
– SeleniumHelper (higher-level WebDriver utilities)
4. Page Object Layer
– PageInitializer / PageObjectManager
– Page classes (Login_Page, Home_Page, etc.)
5. External Dependencies
– Selenium WebDriver
– Browser (Chrome, Firefox, etc.)
– Logging (log4j2)
– Database (via DBConfig.properties, if used)
6. Build & Reporting
– Maven (pom.xml)
– Extent Reports (extent-config.xml)

##### Component Relationships and Data Flow
Feature Files → TestRunner → Cucumber Engine → Step Definitions
Step Definitions → (via PageObjectManager) → Page Objects → SeleniumHelper → DriverManager → Browser
ConfigurationManager → provides config to DriverManager & ExecutionContext
ExecutionContext → shared state across hooks, steps, page objects
Test Data & Properties → consumed by ConfigurationManager & Step Definitions
Logs → log4j2 → output

##### Architectural Patterns and Design Principles
- Page Object Model (POM) – separation of page interaction logic
- Singleton for ConfigurationManager, DriverManager
- Factory/Manager for Page objects (PageObjectManager)
- Context Object for sharing state (ExecutionContext)
- BDD with Cucumber (clear separation of feature, definition, runner)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Artifacts
    subgraph "Test Artifacts"
        direction TB
        FeatureFiles["Feature Files"]:::artifacts
        TestDataProps["Test Data & Properties"]:::artifacts
    end

    %% Test Engine
    subgraph "Test Engine"
        direction TB
        TestRunner["TestRunner (JUnit + Cucumber)"]:::engine
        Hooks["Cucumber Hooks"]:::engine
        CommonSteps["CommonStepDefinition"]:::engine
        Steps["StepDefinition"]:::engine
    end

    %% Framework Core
    subgraph "Framework Core"
        direction TB
        ConfigMgr["ConfigurationManager"]:::core
        DriverMgr["DriverManager"]:::core
        ExecCtx["ExecutionContext"]:::core
        SeleniumUtil["SeleniumHelper"]:::core
    end

    %% Page Object Layer
    subgraph "Page Object Layer"
        direction TB
        PageInit["PageInitializer"]:::pom
        PageMgr["PageObjectManager"]:::pom
        LoginPage["Login_Page"]:::pom
        HomePage["Home_Page"]:::pom
        AddEmpPage["AddEmployee_Page"]:::pom
        AppMasterPage["ApplicationMaster_Page"]:::pom
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        Browser["Browser (Chrome/Firefox)"]:::external
        Database["Database"]:::external
        Logging["log4j2 Logging"]:::external
        Maven["Maven (pom.xml)"]:::external
        ExtentRep["Extent Reports"]:::external
    end

    %% Flows
    FeatureFiles -->|"runs via"| TestRunner
    TestDataProps -->|consumed by| ConfigMgr
    TestDataProps -->|used in| CommonSteps
    TestRunner -->|"triggers"| Hooks
    TestRunner -->|"executes"| CommonSteps
    TestRunner -->|"executes"| Steps

    CommonSteps -->|"call"| PageMgr
    Steps -->|"call"| PageMgr

    PageMgr -->|"provides objects to"| PageInit
    PageInit -->|"initializes"| LoginPage
    PageInit -->|"initializes"| HomePage
    PageInit -->|"initializes"| AddEmpPage
    PageInit -->|"initializes"| AppMasterPage

    PageInit -->|"uses"| SeleniumUtil
    SeleniumUtil -->|"requests driver from"| DriverMgr
    DriverMgr -->|"manages WebDriver for"| Browser

    ConfigMgr -->|"provides config to"| DriverMgr
    ConfigMgr -->|"provides config to"| ExecCtx
    Hooks -->|"stores state in"| ExecCtx
    CommonSteps -->|"accesses state from"| ExecCtx

    Database -->|"config via DBConfig.properties"| ConfigMgr
    Logging -->|"logs via log4j2.xml"| Hooks
    ExtentRep -->|"configured by extent-config.xml"| Hooks
    Maven -->|"builds with pom.xml"| TestRunner

    %% Click Events
    click FeatureFiles "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/resources/Feature/OrangeHRM/AddEmployee.feature"
    click TestDataProps "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/resources/Properties/TestConfig.properties"
    click TestDataProps "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/resources/Properties/extent-config.xml"
    click TestDataProps "https://github.com/surajsingh3091/nextgenerationautomationframework/tree/main/src/test/resources/TestData"
    click TestDataProps "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/resources/Properties/DBConfig.properties"
    click TestRunner "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/java/TestRunner/TestRunner.java"
    click Hooks "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/java/StepDefinition/TestHooks/CucumberHooks.java"
    click CommonSteps "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/java/StepDefinition/CommonStepDefinition.java"
    click Steps "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/test/java/StepDefinition/StepDefinition.java"
    click ConfigMgr "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/com/nextZen/Framework/ConfigReaderUtility/ConfigurationManager.java"
    click DriverMgr "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/com/nextZen/Framework/Base/DriverManager.java"
    click ExecCtx "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/com/nextZen/Framework/ExecutionContext/ExecutionContext.java"
    click SeleniumUtil "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/com/nextZen/Framework/WebUtility/SeleniumHelper.java"
    click PageInit "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/PageInitializer/PageInitializer.java"
    click PageMgr "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/PageObjectManager/PageObjectManager.java"
    click LoginPage "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/Pages/Login_Page.java"
    click HomePage "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/Pages/Home_Page.java"
    click AddEmpPage "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/Pages/AddEmployee_Page.java"
    click AppMasterPage "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/java/application/PageRepository/Pages/ApplicationMaster_Page.java"
    click Logging "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/src/main/resources/log4j2.xml"
    click Maven "https://github.com/surajsingh3091/nextgenerationautomationframework/blob/main/pom.xml"

    %% Styles
    classDef artifacts fill:#cce5ff,stroke:#3399ff,color:#003366;
    classDef engine fill:#d4edda,stroke:#28a745,color:#155724;
    classDef core fill:#fff3cd,stroke:#ffecb5,color:#856404;
    classDef pom fill:#ffe5cc,stroke:#ff9933,color:#663300;
    classDef external fill:#f8d7da,stroke:#dc3545,color:#721c24;
```
