# infosys/selenium-testing-automation-framework architecture

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

- Interactive diagram: https://gitdiagram.com/infosys/selenium-testing-automation-framework
- Repository: https://github.com/infosys/selenium-testing-automation-framework

## Overview

##### Project type and purpose
- This is an open-source, data-driven test automation framework (“Selenium OSTAF”) built in Java/Maven that uses TestNG, Excel spreadsheets, and Selenium WebDriver to drive browser‐based tests without writing code for each script.

##### Main components of the system
a. Launcher/Entry Point
- MainTestNG (invoked via `java -jar SeleniumOSTAF-*.jar`)
- testng.xml
b. Configuration Reader
- ReadConfigProperty reads `config.properties` (app URL, browser, driver path, Excel paths)
c. Data Sources
- TestSuite2.xlsx – list of test case names + YES/NO flags
- TestCases2.xlsx – sheet “TestCase” (test steps) and sheet “CapturedObjectProperties” (locator definitions)
- driverserver.exe (external browser driver)
d. Excel Handling Layer
- ExcelLibrary / ExcelAction (POI wrappers)
- ReadExcelSuite (reads TestSuite sheet)
- ExecuteTestCases (orchestrates reading and dispatching each TestCase)
e. TestNG Execution Engine
- MainTestNG calls TestNG, passing testng.xml
- TestNG orchestrates test classes in `actions` package
f. Action Modules (`actions` package)
- FileDownloadTest, CheckFileHash, FileDownloader (example test actions)
- HashType, MethodType (enum definitions of operations)
g. Model Objects (`model` package)
- TestCase, CapturedObjectPropModel, MethodParameters (hold data for each test step)
h. Selenium Wrapper
- WebDriverClass (instantiates WebDriver per config)
i. Utility Services (`util` package)
- Logger, Report (custom logging & reporting)
- TestListener (TestNG listener for events)
- SwingTest (optional UI)
j. External System Under Test
- The web application accessed via URL

##### Relationships and data flow
1. User invokes JAR → MainTestNG
2. MainTestNG → ReadConfigProperty loads environment settings
3. ExecuteTestCases & ReadExcelSuite read TestSuite2.xlsx → determine which TestCases to run
4. For each enabled TestCase:
a. ExcelAction/ExcelLibrary read TestCase steps & CapturedObjectProperties → instantiate Model objects
b. TestNG executes the corresponding action class (e.g., FileDownloadTest)
c. Action Modules → call WebDriverClass → drive browser interactions or custom operations
d. Each step passes through Logger & TestListener → report events
5. Report module aggregates results → final HTML/console report

##### Architectural patterns & design principles
- Data-driven: test logic separated from test data (Excel sheets)
- Modular actions: each test type lives in its own class in `actions`
- Separation of concerns: distinct packages for models, utilities, actions
- Pluggable TestNG engine: can add/remove tests by editing Excel or action classes

- Clear component names

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Launcher
    subgraph "Launcher / Entry Point"
        direction TB
        MainTestNG["MainTestNG"]:::core
        TestNGXML["testng.xml"]:::core
    end

    %% Configuration
    subgraph "Configuration Reader"
        direction TB
        ReadConfigProperty["ReadConfigProperty"]:::core
        ConfigProp[(config.properties)]:::datasource
    end

    %% Data Sources
    subgraph "Data Sources"
        direction TB
        TestSuiteXlsx[(TestSuite2.xlsx)]:::datasource
        TestCasesXlsx[(TestCases2.xlsx)]:::datasource
        DriverExe[(driverserver.exe)]:::datasource
    end

    %% Excel Handling
    subgraph "Excel Handling Layer"
        direction TB
        ExcelLibrary["ExcelLibrary"]:::core
        ExcelAction["ExcelAction"]:::core
        ReadExcelSuite["ReadExcelSuite"]:::core
        ExecuteTestCases["ExecuteTestCases"]:::core
    end

    %% TestNG Engine
    subgraph "TestNG Execution Engine"
        direction TB
        TestNGEngine["TestNG Engine"]:::core
    end

    %% Action Modules
    subgraph "Action Modules"
        direction TB
        FileDownloadTest["FileDownloadTest"]:::action
        CheckFileHash["CheckFileHash"]:::action
        FileDownloader["FileDownloader"]:::action
        HashType["HashType"]:::action
        MethodType["MethodType"]:::action
    end

    %% Model Objects
    subgraph "Model Objects"
        direction TB
        TestCaseModel["TestCase"]:::model
        CapturedProp["CapturedObjectPropModel"]:::model
        MethodParams["MethodParameters"]:::model
    end

    %% Selenium Wrapper
    subgraph "Selenium Wrapper"
        direction TB
        WebDriverClass["WebDriverClass"]:::wrapper
    end

    %% Utility Services
    subgraph "Utility Services"
        direction TB
        Logger["Logger"]:::util
        Report["Report"]:::util
        TestListener["TestListener"]:::util
        SwingTest["SwingTest"]:::util
        ReadLocators["ReadElementLocators"]:::util
    end

    %% External System
    WebApp["External Web Application"]:::external

    %% Pom and Docs
    subgraph "Project Metadata"
        direction TB
        Pom["pom.xml"]:::meta
        License["LICENSE.txt"]:::meta
        Readme["Readme.md"]:::meta
    end

    %% Connections
    MainTestNG -->|"reads"| ReadConfigProperty
    ReadConfigProperty -->|"loads"| ConfigProp
    MainTestNG -->|"reads suite"| ReadExcelSuite
    ReadExcelSuite -->|"reads"| TestSuiteXlsx
    MainTestNG -->|"orchestrates"| ExecuteTestCases
    ExecuteTestCases -->|"reads steps"| ExcelAction
    ExcelAction -->|"uses"| ExcelLibrary
    ExcelAction -->|"reads locators"| ReadLocators
    ExecuteTestCases -->|"reads cases"| TestCasesXlsx
    ExecuteTestCases -->|"invokes"| TestNGEngine
    TestNGEngine -->|"executes tests"| FileDownloadTest
    TestNGEngine -->|"executes tests"| CheckFileHash
    TestNGEngine -->|"executes tests"| FileDownloader
    FileDownloadTest -->|"uses enum"| HashType
    FileDownloadTest -->|"uses enum"| MethodType
    FileDownloadTest -->|"operates on model"| TestCaseModel
    FileDownloadTest -->|"operates on model"| CapturedProp
    FileDownloadTest -->|"operates on model"| MethodParams
    FileDownloadTest -->|"drives"| WebDriverClass
    CheckFileHash -->|"drives"| WebDriverClass
    FileDownloader -->|"drives"| WebDriverClass
    WebDriverClass -->|"drives"| WebApp
    FileDownloadTest -->|"logs to"| Logger
    FileDownloadTest -->|"logs to"| TestListener
    TestNGEngine -->|"reports to"| Report
    TestListener -->|"reports events"| Report

    %% Click Events
    click MainTestNG "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/MainTestNG.java"
    click TestNGXML "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/testng.xml"
    click ReadConfigProperty "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ReadConfigProperty.java"
    click ConfigProp "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/resources/config.properties"
    click TestSuiteXlsx "https://github.com/infosys/selenium-testing-automation-framework/blob/master/TestSuite2.xlsx"
    click TestCasesXlsx "https://github.com/infosys/selenium-testing-automation-framework/blob/master/TestCases2.xlsx"
    click ExcelLibrary "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ExcelLibrary.java"
    click ExcelAction "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ExcelAction.java"
    click ReadExcelSuite "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ReadExcelSuite.java"
    click ExecuteTestCases "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ExecuteTestCases.java"
    click FileDownloadTest "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/actions/FileDownloadTest.java"
    click CheckFileHash "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/actions/CheckFileHash.java"
    click FileDownloader "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/actions/FileDownloader.java"
    click HashType "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/actions/HashType.java"
    click MethodType "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/actions/MethodType.java"
    click TestCaseModel "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/model/TestCase.java"
    click CapturedProp "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/model/CapturedObjectPropModel.java"
    click MethodParams "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/model/MethodParameters.java"
    click WebDriverClass "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/WebDriverClass.java"
    click Logger "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/Logger.java"
    click Report "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/Report.java"
    click TestListener "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/TestListener.java"
    click SwingTest "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/SwingTest.java"
    click ReadLocators "https://github.com/infosys/selenium-testing-automation-framework/blob/master/src/main/java/util/ReadElementLocators.java"
    click Pom "https://github.com/infosys/selenium-testing-automation-framework/blob/master/pom.xml"
    click License "https://github.com/infosys/selenium-testing-automation-framework/blob/master/LICENSE.txt"
    click Readme "https://github.com/infosys/selenium-testing-automation-framework/blob/master/Readme.md"

    %% Styles
    classDef datasource fill:#9f6,stroke:#393,stroke-width:1px
    classDef core fill:#6cf,stroke:#039,stroke-width:1px
    classDef action fill:#f96,stroke:#c60,stroke-width:1px
    classDef util fill:#fc3,stroke:#c90,stroke-width:1px
    classDef wrapper fill:#ccc,stroke:#888,stroke-width:1px
    classDef model fill:#f9f,stroke:#c39,stroke-width:1px
    classDef external fill:#eee,stroke:#aaa,stroke-width:1px
    classDef meta fill:#ddd,stroke:#aaa,stroke-width:1px
```
