# rupamdas-lt/ltqa-cbt-selenium architecture

> Architecture diagram of the GitHub repository rupamdas-lt/ltqa-cbt-selenium, 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/rupamdas-lt/ltqa-cbt-selenium
- Repository: https://github.com/rupamdas-lt/ltqa-cbt-selenium

## Overview

##### Project Type and Purpose
- This is a test-automation framework (LTQA Selenium Automation Framework) built in Java.
- It uses Cucumber for BDD, TestNG as the test runner, Selenium WebDriver for browser automation, and integrates with external services (LambdaTest grid, ReportPortal, Sumo Logic, tunnel service).
- Its purpose is to define, execute, and report cross-browser, cross-platform UI tests (and some API verifications) in a reusable, configurable way.

##### File-Structure Analysis
- Top-level:
- pom.xml (Maven build, dependencies, plugins)
- README.md (framework setup and usage)
- Utility/Bash (scripts for tunnel setup, cleanup, hosts entry)
- testng.xml / testng-rerun.xml (TestNG suite definitions)
- Source code (src/main/java):
- DTOs: data-transfer objects for API responses (Swagger, tunnels, test details).
- Pages: Page-Object classes for each UI page or log view.
- Hooks: Cucumber hooks (setup/teardown).
- TestManagers: orchestrators (DriverManager, CapabilityManager, ApiManager, TunnelManager).
- automationHelper: high-level helpers & ReportPortal/Sumo integration.
- factory: BrowserType, Locator, LocatorTypes (Factory pattern for driver and locator).
- utility: shared helpers (BaseClass, EnvSetup, FrameworkConstants, FileLock, ScenarioUtils).
- Test code (src/test):
- features: Cucumber feature files organized by suite (OS regressions, Benchmarking, Tunnel).
- stepDefinitions: glue code mapping Gherkin to Java.
- listeners: TestNG/Cucumber event listeners.
- test resources: cucumber.yaml template, JSON test-data, JSON schemas, sample files.

##### README Insights
- Describes CLI flags (ENV, PARALLEL, CUSTOM_USER_*, Sumo flags) – those represent configuration & environment layer.
- Tunnel setup and host overrides – external helper scripts.
- Video verification via ffmpeg – optional post-processing.

##### Components
a. Core Layers
1. Test Definition Layer
- Cucumber .feature files
- TestNG Runner (TestRunner, FailedTestRunner)
2. Glue Layer
- stepDefinitions (AutomationSetupDefinitions)
- Hooks (Hooks.java)
3. Domain-Logic Layer
- TestManagers (DriverManager, CapabilityManager, TunnelManager, ApiManager)
- factory (BrowserType, Locator)
4. Page-Object Layer
- Pages (LoginPage, TestConsoleLogsPage, etc.)
5. Helper & Utility Layer
- automationHelper (AutomationAPIHelper, LTHooks, TestArtefactsVerificationHelper)
- utility (EnvSetup, ScenarioUtils, FileLockUtility)
6. Data & Config Layer
- DTOs (SwaggerAPIs, Others)
- JSON test data & schemas
- cucumber.yaml, log4j2.yaml, reportportal.properties
7. External Services
- Selenium Grid (LambdaTest)
- Tunnel Service (binary & Utility/Bash scripts)
- ReportPortal
- Sumo Logic
- ffmpeg (video verification)

b. Relationships & Data Flow
1. User invokes `mvn test` with flags → TestNG Runner
2. Runner loads feature files → Cucumber engine → Hooks & stepDefinitions
3. stepDefinitions call TestManagers to:
- configure capabilities → CapabilityManager
- spin up tunnel if needed → TunnelManager + Utility/Bash
- instantiate WebDriver → DriverManager → connects to remote grid
4. Business flows use Page-Object methods → Browser interaction → Grid returns results
5. For API validations: ApiManager calls REST endpoints → DTOs deserialize responses
6. automationHelper verifies artefacts (videos, logs), pushes results → ReportPortal/Sumo Logic
7. test data & config loaded from resources at each stage

##### Architectural Patterns & Design Principles
- Page-Object Model for UI abstraction.
- Factory pattern to instantiate browsers and locators.
- Singleton or Thread-Local for Manager classes to ensure per-thread isolation in parallel runs.
- Layered architecture separating test definitions, orchestration, domain logic, and utilities.
- BDD pattern with Cucumber.

##### Detailed Elements
- Blocks for each major manager and package group.
- Annotations for Maven CLI flags influencing flow (e.g., ENV, PARALLEL).
- Connection from Utility/Bash scripts to TunnelManager.
- Optional ffmpeg integration.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Test Definition Layer
    subgraph "Test Definition Layer"
        direction TB
        FeatureFiles["Cucumber Feature Files"]:::code
        TestRunner["TestRunner"]:::code
        FailedTestRunner["FailedTestRunner"]:::code
    end

    %% Glue Layer
    subgraph "Glue Layer"
        direction TB
        StepDefs["AutomationSetupDefinitions"]:::code
        Hooks["Hooks"]:::code
    end

    %% Domain-Logic Layer
    subgraph "Domain-Logic Layer"
        direction TB
        TestManagers["TestManagers"]:::code
        DriverManager["DriverManager"]:::code
        CapabilityManager["CapabilityManager"]:::code
        TunnelManager["TunnelManager"]:::code
        ApiManager["ApiManager"]:::code
        Factory["Browser & Locator Factory"]:::code
    end

    %% Page-Object Layer
    subgraph "Page-Object Layer"
        direction TB
        Pages["Page-Object Classes"]:::code
    end

    %% Helper & Utility Layer
    subgraph "Helper & Utility Layer"
        direction TB
        AutomationHelpers["Automation Helpers"]:::code
        FrameworkUtils["Framework Utilities"]:::code
    end

    %% Data & Config Layer
    subgraph "Data & Config Layer"
        direction TB
        DTOs["DTOs"]:::config
        TestData["Test Data & JSON Schemas"]:::config
        ConfigFiles["Configuration Files"]:::config
    end

    %% External Services
    subgraph "External Services"
        direction TB
        SeleniumGrid["LambdaTest Grid"]:::external
        TunnelService["Tunnel Service Scripts"]:::external
        ReportPortal["ReportPortal"]:::external
        SumoLogic["Sumo Logic"]:::external
        FFmpeg["ffmpeg"]:::external
    end

    %% Connections
    FeatureFiles -->|"loaded by"| TestRunner
    FeatureFiles -->|"loaded by"| FailedTestRunner
    TestRunner -->|"triggers"| StepDefs
    FailedTestRunner -->|"triggers"| StepDefs
    StepDefs -->|"uses hooks"| Hooks
    StepDefs -->|"calls"| DriverManager
    StepDefs -->|"calls"| CapabilityManager
    StepDefs -->|"calls"| TunnelManager
    StepDefs -->|"calls"| ApiManager
    CapabilityManager -->|"provides capabilities to"| DriverManager
    TunnelManager -->|"starts tunnel via"| TunnelService
    DriverManager -->|"connects to"| SeleniumGrid
    ApiManager -->|"calls external APIs"| DTOs
    DriverManager -->|"drives"| Pages
    Pages -->|"interact with"| SeleniumGrid
    ApiManager -->|"uses DTOs"| DTOs
    DriverManager -->|"outputs logs/videos"| AutomationHelpers
    AutomationHelpers -->|"pushes results to"| ReportPortal
    AutomationHelpers -->|"pushes logs to"| SumoLogic
    AutomationHelpers -->|"verifies videos with"| FFmpeg
    FrameworkUtils -->|"provides config to"| CapabilityManager
    ConfigFiles -->|"load config"| FrameworkUtils
    TestData -->|"load test data"| StepDefs

    %% Click Events
    click FeatureFiles "https://github.com/rupamdas-lt/ltqa-cbt-selenium/tree/main/src/test/features"
    click TestRunner "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/runners/TestRunner.java"
    click FailedTestRunner "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/runners/FailedTestRunner.java"
    click StepDefs "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/test/java/stepDefinitions/AutomationSetupDefinitions.java"
    click Hooks "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/Hooks/Hooks.java"
    click DriverManager "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/TestManagers/DriverManager.java"
    click CapabilityManager "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/TestManagers/CapabilityManager.java"
    click TunnelManager "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/TestManagers/TunnelManager.java"
    click ApiManager "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/TestManagers/ApiManager.java"
    click Factory "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/factory/BrowserType.java"
    click Factory "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/factory/Locator.java"
    click Factory "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/factory/LocatorTypes.java"
    click Pages "https://github.com/rupamdas-lt/ltqa-cbt-selenium/tree/main/src/main/java/Pages/"
    click AutomationHelpers "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/automationHelper/AutomationAPIHelper.java"
    click AutomationHelpers "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/automationHelper/AutomationHelper.java"
    click AutomationHelpers "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/automationHelper/ClientAutomationHelper.java"
    click AutomationHelpers "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/automationHelper/LTHooks.java"
    click AutomationHelpers "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/automationHelper/TestArtefactsVerificationHelper.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/BaseClass.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/CustomSoftAssert.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/EnvSetup.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/FileLockUtility.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/FrameworkConstants.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/ScenarioUtils.java"
    click FrameworkUtils "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/java/utility/UrlsAndLocators.java"
    click DTOs "https://github.com/rupamdas-lt/ltqa-cbt-selenium/tree/main/src/main/java/DTOs/"
    click TestData "https://github.com/rupamdas-lt/ltqa-cbt-selenium/tree/main/src/test/resources/TestData"
    click TestData "https://github.com/rupamdas-lt/ltqa-cbt-selenium/tree/main/src/test/resources/TestData/jsonSchemas"
    click ConfigFiles "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/resources/log4j2.yaml"
    click ConfigFiles "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/main/resources/reportportal.properties"
    click ConfigFiles "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/src/test/resources/cucumber.sample.yaml"
    click TunnelService "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/Utility/Bash/SetupTunnelBinary.sh"
    click TunnelService "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/Utility/Bash/GetTunnelServers.sh"
    click TunnelService "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/Utility/Bash/UpdateHostEntry.sh"
    click TunnelService "https://github.com/rupamdas-lt/ltqa-cbt-selenium/blob/main/Utility/Bash/Cleanup.sh"

    %% Styles
    classDef code fill:#add8e6,stroke:#000,stroke-width:1px
    classDef external fill:#98fb98,stroke:#000,stroke-width:1px
    classDef config fill:#ffff99,stroke:#000,stroke-width:1px
    classDef util fill:#d3d3d3,stroke:#000,stroke-width:1px
```
