# anhtester/automationframeworkcucumbertestng architecture

> Architecture diagram of the GitHub repository anhtester/automationframeworkcucumbertestng, 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/automationframeworkcucumbertestng
- Repository: https://github.com/anhtester/automationframeworkcucumbertestng

## Overview

##### Main Components
- Test Execution Layer: Represent the runners and test suites located under src/test (e.g., TestRunnerAllFeatureByTag, LoginCMSTestRunner).
- Feature & Step Definitions: Highlight the use of Cucumber feature files (in src/test/resources/features) and step definition classes (e.g., LoginSteps, DashboardSteps).
– Annotations: FrameworkAnnotation for marking tests.
– Config: ConfigFactory and Configuration for managing system settings.
– Constants: FrameworkConstants containing global settings or base paths.
– Driver Management: BrowserFactory, DriverManager, TargetFactory ensuring browser control and Selenium session management.
– Enums & Exceptions: Define types such as Browser, Platform, FailureHandling, and custom exceptions.
– Helpers & Utils: Modular packages providing functionalities for screen recording, file handling, Excel/JSON parsing, logging, etc.
– Keywords: The WebUI class holds core actions (e.g., clicking, waiting, verifying UI elements).
– Mail & Report Modules: EmailConfig, EmailAttachmentsSender for sending test reports via email, and AllureManager, ExtentReportManager, ExtentTestManager, TelegramManager for reporting.

##### Relationships and Data Flow
- How test cases (under src/test) use the TestNG and Cucumber runners to trigger test execution.
- Demonstrate how the runners call the “WebUI” keyword methods and how these keywords, in turn, interact with the driver layer (BrowserFactory/DriverManager) to open browsers and execute Selenium commands.
- That configuration and constant modules have a cross-cutting role, feeding settings to all components (e.g., specifying browser type from Maven commands).
- CI/CD aspect showing the GitHub Actions workflow (maven.yml) that builds and triggers tests on commit.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project clearly delineates responsibilities (tests, drivers, reporting, config, and utilities).
- Factory/Utility Patterns: The driver management package uses factory patterns (e.g., BrowserFactory, TargetFactory) to manage browser instantiation.
- Extensibility: The modular setup (distinct packages for drivers, helpers, reports) makes it easy to add new functionality or adapt to changes.
- Parallel Execution Support: The ability to run tests in parallel (as noted in the README) suggests that the design carefully isolates test execution contexts.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Test Layer
    subgraph "Test Layer"
        TR["Test Runners"]:::test
        TS["Test Suites"]:::test
        FF["Cucumber Feature Files"]:::test
        CMS["CMS Step Definitions"]:::test
        CRM["CRM Step Definitions"]:::test
    end

    %% Core Automation Engine
    subgraph "Core Automation Engine"
        FA["Framework Annotation"]:::engine
        CM["Config Module"]:::engine
        FC["Framework Constants"]:::engine
        DM["Driver Management"]:::engine
        HL["Helpers"]:::engine
        UT["Utils"]:::engine
        WUI["Keywords (WebUI)"]:::engine
        EN["Enums"]:::engine
        EX["Exceptions"]:::engine
    end

    %% Reporting & Email
    subgraph "Reporting & Email"
        MM["Mail Module"]:::report
        RM["Reporting & Notification"]:::report
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        CA["GitHub Actions Workflow"]:::cicd
    end

    %% Connections between high level nodes
    CA --> TR
    TS --> TR
    TR -->|"calls"| WUI
    FF -->|"triggers"| CMS
    FF -->|"triggers"| CRM
    CMS -->|"executes"| WUI
    CRM -->|"executes"| WUI
    HL --> WUI
    UT --> WUI
    WUI -->|"initiates"| DM
    WUI -->|"utilizes"| EN
    WUI -->|"handles"| EX
    CM -->|"configures"| DM
    CM -->|"configures"| WUI
    CM -->|"configures"| RM
    CM -->|"configures"| MM
    FC -->|"defines"| CM
    TR -->|"sendsResultsTo"| MM
    TR -->|"sendsResultsTo"| RM

    %% Styles
    classDef test fill:#ffdddd,stroke:#cc0000,stroke-width:2px;
    classDef engine fill:#ddffdd,stroke:#009900,stroke-width:2px;
    classDef report fill:#ddf3ff,stroke:#003366,stroke-width:2px;
    classDef cicd fill:#fff0b3,stroke:#993300,stroke-width:2px;

    %% Click Events
    click TR "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/test/java/com/anhtester/runners"
    click TS "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/test/resources/suites"
    click FF "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/test/resources/features"
    click CMS "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/test/java/com/anhtester/projects/website/cms/stepdefinitions"
    click CRM "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/test/java/com/anhtester/projects/website/crm/stepdefinitions"
    click FA "https://github.com/anhtester/automationframeworkcucumbertestng/blob/main/src/main/java/com/anhtester/annotations/FrameworkAnnotation.java"
    click CM "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/config"
    click FC "https://github.com/anhtester/automationframeworkcucumbertestng/blob/main/src/main/java/com/anhtester/constants/FrameworkConstants.java"
    click DM "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/driver"
    click EN "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/enums"
    click EX "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/exceptions"
    click HL "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/helpers"
    click UT "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/utils"
    click WUI "https://github.com/anhtester/automationframeworkcucumbertestng/blob/main/src/main/java/com/anhtester/keywords/WebUI.java"
    click MM "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/mail"
    click RM "https://github.com/anhtester/automationframeworkcucumbertestng/tree/main/src/main/java/com/anhtester/reports"
    click CA "https://github.com/anhtester/automationframeworkcucumbertestng/blob/main/.github/workflows/maven.yml"
```
