# iamcharankumar/web_test_framework architecture

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

- Interactive diagram: https://gitdiagram.com/iamcharankumar/web_test_framework
- Repository: https://github.com/iamcharankumar/web_test_framework

## Overview

##### Main Components
- Test Runner / Executor: Represent Maven, TestNG, and parallel test execution configuration that kicks off the test suites.
- Test Cases and Test Data: Under the “src/test” package, this includes the test case classes (e.g., LoginPageTest, CartPageTest) and data providers.
- Core Test Framework:
- Page Objects: Found in the “src/main/java/io/saucelabs/portal/qa/pages” package (e.g., HomePage, LoginPage, SauceLabsBasePage) and common base classes (WebBasePage, WebConstants).
- Browser Manager: Modules in the “src/main/java/io/saucelabs/portal/qa/browsermanager” package (like BrowserFactory, ChromeBrowser, FirefoxBrowser, MsEdgeBrowser) that abstract browser instantiation and manage WebDriver sessions.
- Utilities & Helpers: Classes in “src/main/java/io/saucelabs/portal/qa/utils”, “waits”, “locators”, and “exceptions” packages to support logging, configuration, synchronization, and error management.
- Modules & Locators: Modules like SauceLabsPortal and locator interfaces/implementations help bind page elements to actions.
- Config & Resources: The configuration files (config.properties) and the Docker Compose YAML file found in “src/main/java/resources” for setting up the Selenium Grid.
- External Integrations:
- Report Portal: As described in the README, with steps to integrate test reports via Report Portal.
- Discord Messaging Service: For sending notifications with report metrics.
- Docker / Selenium Grid Setup: For executing tests remotely (with separate containers for Chrome and Firefox nodes).

##### Interactions and Relationships
- Test Cases use the Page Objects and Core Utilities to execute tests.
- The Browser Manager locates and instantiates the appropriate browser driver based on configuration (local, headless, or remote mode).
- Maven (pom.xml) acts as the build tool that integrates all pieces together, driving test execution.

##### Architectural Patterns and Design Principles
- The framework follows the Page Object Model (POM) for maintainability and clarity in how page elements are identified and used.
- Dependency injection or factory patterns (as evidenced by the BrowserFactory) are used to instantiate browser drivers.
- The layered approach separates tests, page representations, browser management, utilities, and exception handling.
- Parallel execution/configuration is a key design to improve test throughput (as indicated by the TestNG parallel commands in the README).

##### Relevant Technologies and Frameworks
- Java, Maven, TestNG, Selenium WebDriver.
- Docker and Docker Compose for remote execution with a Selenium Grid.
- Report Portal for result aggregation and analysis.
- Discord webhooks for notifications.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Test Orchestration Layer
    subgraph "Test Orchestration"
        Executor["Test Executor (Maven + TestNG)"]:::orchestration
        TestCases["Test Cases"]:::orchestration
        TestData["Test Data"]:::orchestration
        Executor -->|"triggers"| TestCases
        TestData -->|"provides"| TestCases
    end

    %% Core Test Framework Layer
    subgraph "Core Test Framework"
        subgraph "Page Layer"
            PageObjects["Page Objects"]:::core
            BasePages["Base Pages & Constants"]:::core
        end
        TestCases -->|"uses"| PageObjects
        TestCases -->|"uses"| BasePages

        BrowserManager["Browser Manager (Abstracts WebDriver)"]:::core
        TestCases -->|"requests_browser"| BrowserManager

        subgraph "Utilities & Helpers"
            Utilities["Utilities"]:::core
            Waits["Waits"]:::core
            Locators["Locators"]:::core
            Exceptions["Exception Handling"]:::core
        end
        TestCases -->|"utilizes"| Utilities
        TestCases -->|"utilizes"| Waits
        TestCases -->|"utilizes"| Locators
        TestCases -->|"handles_errors_with"| Exceptions

        Modules["Modules & Locators"]:::core
        TestCases -->|"relies_on"| Modules
    end

    %% Configuration & Resources Layer
    subgraph "Configuration & Resources"
        ConfigFile["Config File"]:::config
        DockerCompose["Docker Compose (Selenium Grid)"]:::config
        BrowserManager -->|"reads_config_from"| ConfigFile
    end

    %% External Services Layer
    subgraph "External Services"
        SeleniumGrid["Selenium Grid (Docker)"]:::external
        ReportPortal["Report Portal Integration"]:::external
        Discord["Discord Notification Service"]:::external
        BrowserManager -->|"initiates_sessions_on"| SeleniumGrid
        DockerCompose -->|"orchestrates"| SeleniumGrid
        Executor -->|"reports_to"| ReportPortal
        Executor -->|"notifies_via"| Discord
    end

    %% Styles
    classDef orchestration fill:#FFEEAD,stroke:#B58900,stroke-width:2px;
    classDef core fill:#C3FDB8,stroke:#2AA198,stroke-width:2px;
    classDef config fill:#CFF9FF,stroke:#268BD2,stroke-width:2px;
    classDef external fill:#FFCCD9,stroke:#D33682,stroke-width:2px;

    %% Click Events
    click Executor "https://github.com/iamcharankumar/web_test_framework/blob/master/pom.xml"
    click TestCases "https://github.com/iamcharankumar/web_test_framework/tree/master/src/test/java/io/saucelabs/portal/qa/testcases"
    click TestData "https://github.com/iamcharankumar/web_test_framework/blob/master/src/test/java/io/saucelabs/portal/qa/testdata/SauceLabsDataProvider.java"
    click PageObjects "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/pages"
    click BasePages "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/commons"
    click BrowserManager "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/browsermanager"
    click Utilities "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/utils"
    click Waits "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/waits"
    click Locators "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/locators"
    click Exceptions "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/exceptions"
    click Modules "https://github.com/iamcharankumar/web_test_framework/tree/master/src/main/java/io/saucelabs/portal/qa/module"
    click ConfigFile "https://github.com/iamcharankumar/web_test_framework/blob/master/src/main/java/resources/config.properties"
    click DockerCompose "https://github.com/iamcharankumar/web_test_framework/blob/master/src/main/java/resources/docker-compose-v3.yml"
```
