# sumit5426/selenium-java-test-automation-framework architecture

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

- Interactive diagram: https://gitdiagram.com/sumit5426/selenium-java-test-automation-framework
- Repository: https://github.com/sumit5426/selenium-java-test-automation-framework

## Overview

##### Project Type and Purpose
- This is an **open-source Selenium-Java Test Automation Framework**, a hybrid framework combining **data-driven** and **modular** approaches.
- Its purpose is to provide a scalable, maintainable test-automation solution with support for multiple data formats, parallel and headless execution, cloud integration (LambdaTest), rich reporting (Extent Reports), and CI/CD via GitHub Actions.

##### File Structure
- **Top-level files/config**:
- pom.xml (Maven build & Surefire configuration)
- config/ (DEV, QA, UAT .properties + config.json)
- TestData/ (Excel, JSON, CSV)
- .github/workflows/maven.yml (CI pipeline)
- testng.xml (TestNG suite definition)
- reports.html, test-output/ (local reports)
- **src/test/java**:
- pages/ → Page Object Model (POM) classes
- uipopjo/ → POJO models for test-data
- uidataprovider/ → TestNG data providers
- uilistener/ → TestNG listeners & retry analyzer
- uiutility/ → Utilities (CSVReader, ExcelReader, JsonUtility, LoggerUtility, ExtentReportUtility, BrowserUtility, Faker utility, LambdaTest utility, PropertiesUtil)
- uitest/ → Test classes (TestBase, LoginTest, AddNewAddressTest, ProductCheckOut, SearchProductTest, etc.)
- **src/test/resources**:
- log4j2.xml (logging configuration)

##### README for Additional Insights
- Framework features: POM, Singleton pattern, POJO, data-driven via Excel/CSV/JSON/Properties, Faker for fake data.
- Execution flags: isHeadless, isLambdaTest, environment, browserName.
- Cloud integration: LambdaTest.
- Reporting: Extent Reports, Log4j.
- CI: GitHub Actions scheduled nightly, reports published to gh-pages.

a. Main Components
1. **Test Runner** (TestNG + Maven Surefire)
2. **Test Suite** (testng.xml, uitest package)
3. **Test Base & Browser Utility** (initializes WebDriver, manages headless/cloud execution)
4. **Page Objects** (pages package)
5. **Data Layer**
– Data Providers (uidataprovider)
– Test Data stores (Excel, CSV, JSON, Properties)
– POJO Models (uipopjo)
6. **Utility Layer** (uiutility)
– CSV/Excel/JSON Readers
– LoggerUtility (Log4j)
– ExtentReportUtility (reports)
– FakerAddressUtility
– LambdaTestUtility
– PropertiesUtil
7. **Listeners & Retry Analyzer** (uilisteners)
8. **External Services**
– LambdaTest Cloud
– GitHub Actions (CI/CD)
– gh-pages (report hosting)
b. Relationships & Interactions
- **TestNG Suite** invokes **TestBase**, passing runtime parameters (browserName, environment, isHeadless, isLambdaTest).
- **TestBase** calls **BrowserUtility** → starts local or LambdaTest WebDriver instance.
- **Test Classes** request test data from **Data Providers**, which load from JSON/Excel/CSV/Properties via **Utility Layer**, mapping into POJOs.
- **Test Classes** use **Page Objects** to interact with the AUT (Application Under Test).
- **Listeners** hook into TestNG lifecycle to capture failures, take screenshots, trigger retries.
- **Utilities** log test steps (Log4j) and build report entries (Extent Reports).
- **Maven** packages & runs tests; outputs go into test-output/ and reports.html.
- **GitHub Actions** triggers mvn test nightly, collects reports, publishes to gh-pages.
c. Architectural Patterns & Principles
- **Page Object Model (POM)** for UI abstraction.
- **Singleton** pattern for WebDriver & configuration instances.
- **Data-Driven** via TestNG data providers + POJOs.
- **Modular** separation: test logic, page objects, data, utilities, configuration.
- **Dependency Inversion**: Tests depend on interfaces/utilities rather than concrete readers.
d. Key Technologies/Frameworks
- Java 17, Maven, TestNG, Selenium WebDriver
- Apache POI (Excel), OpenCSV, Gson (JSON)
- Faker, LambdaTest SDK, Log4j2, Extent Reports
- GitHub Actions for CI/CD

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Orchestration Layer
    subgraph "Test Orchestration" 
        direction TB
        Runner["Test Runner<br/>(TestNG & Maven)"]:::orchestration
        TestSuite["Test Suite<br/>(uitest)"]:::orchestration
    end

    %% Framework Core Layer
    subgraph "Framework Core"
        direction TB
        TestBase["TestBase"]:::core
        BrowserUtil["BrowserUtility"]:::core
        subgraph "Page Objects"
            direction TB
            ConfirmAddressPage["ConfirmAddressPage"]:::core
            HomePage["HomePage"]:::core
            LoginPage["LoginPage"]:::core
            MyAccountPage["MyAccountPage"]:::core
            NewAddressAddPage["NewAddressAddPage"]:::core
            PaymentPage["PaymentPage"]:::core
            ProductDetailPage["ProductDetailPage"]:::core
            SearchResultPage["SearchResultPage"]:::core
            ShipmentPage["ShipmentPage"]:::core
            ShoppingCartPage["ShoppingCartPage"]:::core
        end
        subgraph "Utilities"
            direction TB
            CSVReaderUtility["CSVReaderUtility"]:::core
            ExcelReaderUtility["ExcelReaderUtility"]:::core
            JsonUtility["JsonUtility"]:::core
            PropertiesUtil["PropertiesUtil"]:::core
            LoggerUtility["LoggerUtility"]:::core
            ExtentReportUtility["ExtentReportUtility"]:::core
            FakerAddressUtility["FakerAddressUtility"]:::core
            LambdaTestUtility["LambdaTestUtility"]:::core
        end
        Listeners["Listeners & Retry Analyzer"]:::core
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DataProviders["Data Providers"]:::data
        subgraph "Test Data Stores"
            direction TB
            ExcelData[(Excel Files)]:::data
            JsonData[(JSON Files)]:::data
            CsvData[(CSV Files)]:::data
            PropertiesData[(Properties Files)]:::data
        end
        subgraph "POJO Models"
            direction TB
            AddressPojo["AddressPojo"]:::data
            ConfigPojo["Config"]:::data
            EnvironmentPojo["Environment"]:::data
            TestDataPojo["TestData"]:::data
            UserPojo["User"]:::data
        end
    end

    %% CI/CD & Cloud
    subgraph "CI/CD & Cloud"
        direction TB
        GitHubActions["GitHub Actions"]:::external
        LambdaTestCloud["LambdaTest Cloud"]:::external
        GhPages["gh-pages Report Hosting"]:::external
    end

    %% Connections
    Runner -->|"runs suite"| TestSuite
    TestSuite -->|"initializes"| TestBase
    TestBase -->|"uses"| BrowserUtil
    BrowserUtil -->|"launches"| LambdaTestCloud
    TestSuite -->|"uses"| DataProviders
    DataProviders -->|"reads from"| ExcelData
    DataProviders -->|"reads from"| JsonData
    DataProviders -->|"reads from"| CsvData
    DataProviders -->|"reads from"| PropertiesData
    DataProviders -->|"maps to"| AddressPojo
    DataProviders -->|"maps to"| ConfigPojo
    DataProviders -->|"maps to"| EnvironmentPojo
    DataProviders -->|"maps to"| TestDataPojo
    DataProviders -->|"maps to"| UserPojo
    TestSuite -->|"interacts with"| PageObjects
    TestSuite -->|"logs/reports via"| LoggerUtility
    TestSuite -->|"reports via"| ExtentReportUtility
    TestSuite -->|"hooks"| Listeners
    GitHubActions -->|"triggers mvn test"| Runner
    Runner -->|"outputs reports to"| GhPages

    %% Click Events
    click Runner "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/pom.xml"
    click Runner "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/testng.xml"
    click GitHubActions "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/.github/workflows/maven.yml"
    click TestSuite "https://github.com/sumit5426/selenium-java-test-automation-framework/tree/main/src/test/java/uitest/"
    click TestBase "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uitest/TestBase.java"
    click BrowserUtil "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/BrowserUtility.java"
    click ConfirmAddressPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/ConfirmAddressPage.java"
    click HomePage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/HomePage.java"
    click LoginPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/LoginPage.java"
    click MyAccountPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/MyAccountPage.java"
    click NewAddressAddPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/NewAddressAddPage.java"
    click PaymentPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/PaymentPage.java"
    click ProductDetailPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/ProductDetailPage.java"
    click SearchResultPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/SearchResultPage.java"
    click ShipmentPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/ShipmentPage.java"
    click ShoppingCartPage "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/pages/ShoppingCartPage.java"
    click ExcelData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/TestData/LoginData.xlsx"
    click JsonData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/TestData/loginData.json"
    click CsvData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/TestData/logindata.csv"
    click DataProviders "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uidataprovider/LoginDataProvider.java"
    click AddressPojo "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uipojo/AddressPojo.java"
    click ConfigPojo "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uipojo/Config.java"
    click EnvironmentPojo "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uipojo/Environment.java"
    click TestDataPojo "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uipojo/TestData.java"
    click UserPojo "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uipojo/User.java"
    click CSVReaderUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/CSVReaderUtility.java"
    click ExcelReaderUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/ExcelReaderUtility.java"
    click JsonUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/JsonUtility.java"
    click PropertiesUtil "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/PropertiesUtil.java"
    click LoggerUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/LoggerUtility.java"
    click ExtentReportUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/ExtentReportUtility.java"
    click FakerAddressUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/FakerAddressUtility.java"
    click LambdaTestUtility "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uiutility/LambdaTestUtlity.java"
    click Listeners "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uilisteners/TestListener.java"
    click Listeners "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/src/test/java/uilisteners/MyRetryAnalyzer.java"
    click PropertiesData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/config/DEV.properties"
    click PropertiesData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/config/QA.properties"
    click PropertiesData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/config/UAT.properties"
    click PropertiesData "https://github.com/sumit5426/selenium-java-test-automation-framework/blob/main/config/config.json"

    %% Styles
    classDef orchestration fill:#D6EAF8,stroke:#2980B9
    classDef core fill:#D5F5E3,stroke:#27AE60
    classDef data fill:#FCF3CF,stroke:#D4AC0D
    classDef external fill:#FAD7A0,stroke:#CA6F1E
    class PageObjects,Utilities core
    class ExcelData,JsonData,CsvData,PropertiesData data
```
