# anhtester/automationframeworkselenium architecture

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

- Interactive diagram: https://gitdiagram.com/anhtester/automationframeworkselenium
- Repository: https://github.com/anhtester/automationframeworkselenium

## Overview

##### Main Components
- Framework Core: This includes the configuration, constants, annotations, driver management, and exception handling found under packages such as “config”, “constants”, “annotations”, “driver”, “enums”, and “exceptions”. These are core building blocks that allow tests to interact with the browsers and manage pre-/post-test actions.
- Test Libraries and Helpers: The “helpers”, “utils”, and “keywords” packages encapsulate common functions (for file handling, data generation, screenshots, logging, etc.) and the WebUI keyword interface that is used by test cases.
- Reporting and Notification Modules: Under the “report” package you have classes for Allure and Extent reporting plus a TelegramManager for sending notifications. The mail package provides functionality for dispatching emails once tests complete.
- Data Providers and Test Suites: The “dataprovider” package and test resources (testdata, test suites in XML, etc.) enable data-driven testing and centralized test execution with TestNG.
- Test Cases and Test Runner: The test code in “src/test” (and its organized projects sub-packages for CMS/CRM modules) represents the TestNG test cases that use the core framework functions.
- External Integration Components: The README details integrations with Selenium Grid for remote and parallel test execution and potentially external reporting tools (e.g., Allure, Extent, Telegram).

##### Relationships and Interactions
- The Test Runner (TestNG) initiates test cases that call the WebUI keyword functions.
- The WebUI functions internally utilize the DriverManager (along with BrowserFactory and TargetFactory) to instantiate and configure browser sessions as per the configuration (from properties files).
- The framework’s utilities and helpers provide auxiliary functionality – reading configuration (ConfigFactory/Configuration), logging (LogUtils), file operations, and screenshot/video functions.
- Reporting modules (ExtentTestManager, AllureManager) capture test execution data. These then integrate with external systems such as email (EmailAttachmentsSender) and Telegram (TelegramManager) for notifications.
- Data Providers support reading test input from various file formats (Excel, JSON, CSV) and funnel that data into the test cases.
- Selenium Grid functionality is incorporated via configuration properties and driver setup allowing tests to run remotely over a grid.

##### Architectural Patterns & Design Principles
- Layered Architecture: Separate layers for core infrastructure (setup/configuration), service/util layers (keywords, utilities), and test layer (actual tests and data providers) enhance maintainability.
- Plug-In Extensibility: With dedicated modules for email, reporting, and Selenium Grid integrations, the architecture is extensible and decoupled.
- Test-Driven / Configuration-Centric: With external config (properties files) that control behaviors like parallel execution, screenshot capture, etc., it emphasizes configurability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test Execution Layer
    subgraph "Test Execution"
        BTS["Base Test Setup"]:::test
        TC["Test Cases"]:::test
        LS["Listeners"]:::test
        DP["Data Providers"]:::test
        TS["Test Suites"]:::test
        TD["Test Data"]:::test
        BTS --> TC
    end

    %% Test Libraries & Helpers Layer
    subgraph "Test Libraries & Helpers"
        KW["WebUI Keyword Interface"]:::helpers
        HF["Helper Functions"]:::helpers
        UT["Utilities"]:::helpers
    end

    %% Framework Core Layer
    subgraph "Framework Core"
        CM["Configuration Manager"]:::core
        FC["Framework Constants"]:::core
        AN["Annotations"]:::core
        DM["Driver Management"]:::core
        EN["Enums"]:::core
        EH["Exception Handling"]:::core
    end

    %% Reporting & Notification Layer
    subgraph "Reporting & Notification"
        RM["Reporting Modules"]:::reporting
        EM["Email Notification"]:::reporting
    end

    %% External Integrations Layer
    subgraph "External Integrations"
        SG["Selenium Grid"]:::external
    end

    %% Connections between layers
    TC -->|"calls"| KW
    TC -->|"uses"| DP
    TC -->|"uses"| TS
    TC -->|"uses"| TD
    TC -->|"reports to"| RM
    TC -->|"utilizes"| HF
    TC -->|"utilizes"| UT
    LS -->|"triggers"| RM
    KW -->|"controls"| DM
    CM -->|"configures"| DM
    FC -->|"supports"| DM
    AN -->|"annotates"| DM
    EN -->|"defines"| DM
    EH -->|"handles"| DM
    DM -->|"leverages"| SG
    RM -->|"notifies via"| EM

    %% Click Events - Test Execution
    click TC "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test"
    click BTS "https://github.com/anhtester/automationframeworkselenium/blob/main/src/test/java/com/anhtester/common/BaseTest.java"
    click LS "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test/java/com/anhtester/listeners"
    click DP "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test/java/com/anhtester/dataprovider"
    click TS "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test/resources/suites"
    click TD "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test/resources/testdata"

    %% Click Events - Test Libraries & Helpers
    click KW "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/keywords"
    click HF "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/helpers"
    click UT "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/utils"

    %% Click Events - Framework Core
    click CM "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/config"
    click FC "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/constants"
    click AN "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/annotations"
    click DM "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/driver"
    click EN "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/enums"
    click EH "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/exceptions"

    %% Click Events - Reporting & Notification
    click RM "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/reports"
    click EM "https://github.com/anhtester/automationframeworkselenium/tree/main/src/main/java/com/anhtester/mail"

    %% Click Events - External Integrations
    click SG "https://github.com/anhtester/automationframeworkselenium/tree/main/src/test/resources/config"

    %% Styling classes
    classDef test fill:#f9e79f,stroke:#d35400,stroke-width:2px;
    classDef helpers fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef core fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
    classDef reporting fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef external fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
```
