# sarankumar-primesoft/webautomation architecture

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

- Interactive diagram: https://gitdiagram.com/sarankumar-primesoft/webautomation
- Repository: https://github.com/sarankumar-primesoft/webautomation

## Overview

##### Project Type and Purpose
- Type: Automated end-to-end web-testing framework for an OTT application
- Purpose: Use Selenium WebDriver + TestNG to drive browser tests, log events via Log4j, and produce HTML reports via Extent Reports, all managed by Maven.

##### File Structure
- Configuration folder / config.properties: Holds environment settings (browser, URL, timeouts).
- src/main/resources/log4j2.xml: Logging configuration.
- src/test/java/base/BaseClass.java: Initializes WebDriver & test setup/teardown.
- src/test/java/com/configure/Factory.java, config.java: Reads config and instantiates browser or test data objects.
- src/test/java/com/pom/*.java: Page Object Model classes, each mapping a UI page.
- src/test/java/com/tests & videoplayback_cases: TestNG test classes invoking POM methods.
- src/test/java/com/listeners: TestNG listeners (retry logic, test info capture, annotation hooks).
- pom.xml & testng.xml: Dependency management, build & test execution.
- Logs and Reports directories: /logs, /extent-report, /test-output – runtime outputs.

##### README for Additional Insights
- Confirms use of Java, Maven, Selenium, TestNG, Extent Reports, Log4j.
- Highlights POM for maintainability, cross-browser support, and Maven-based execution.

##### Main Components & Their Interactions
a. Test Execution Layer
– Maven Surefire Plugin invokes TestNG using testng.xml.
– TestNG Driver executes test classes (TC_1…TC_11, TC_Playback).

b. Configuration Module
– Factory reads config.properties → exposes browser type, base URL, credentials.

c. Core Test Framework
– BaseClass: WebDriver lifecycle (init, teardown), reads Factory.
– POM Classes: Encapsulate UI element locators + actions.
– Test Cases: Use BaseClass & POM methods to drive test scenarios.

d. Observability & Reporting
– Log4j 2: Logs each step to automation-log.log per log4j2.xml settings.
– TestNG Listeners: AnnotationListeners, RetryFailedTC, Testinfo intercept test events.
– Extent Reports: Collected by ExtentManager/ExtentReport classes → HTML in /extent-report.

e. External Dependencies
– Browser Drivers (ChromeDriver, GeckoDriver)
– OTT Web Application under test

##### Architectural Patterns & Design Principles
- Page Object Model (POM) – separates page structure & test logic.
- Factory Pattern – encapsulates creation of WebDriver/config objects.
- Singleton – ExtentManager to manage one report instance.
- Observer (Listener) – TestNG listeners capture test lifecycle events.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Execution
    subgraph "Build & Execution"
        Maven["Maven\n(pom.xml)"]:::build
        TestNG["TestNG Runner\n(testng.xml)"]:::build
        Surefire["Surefire Reports\n(target/surefire-reports)"]:::output
    end

    %% Config & Utils
    subgraph "Config & Utils"
        Factory["Factory Class\n(Factory.java)"]:::util
        ConfigReader["Config Reader\n(config.java)"]:::util
        EnvProps["Env Properties\n(config.properties)"]:::util
        Log4jConfig["Log4j Config\n(log4j2.xml)"]:::util
    end

    %% Test Logic
    subgraph "Test Logic"
        BaseClass["BaseClass\n(BaseClass.java)"]:::core
        subgraph "POM Classes"
            POM["Page Object Model Classes\n(com/pom/*.java)"]:::core
        end
        subgraph "Test Cases"
            TCs["Test Cases\n(TC_1…TC_11, TC_Playback)"]:::core
        end
    end

    %% Observability & Reporting
    subgraph "Observability & Reporting"
        AnnotationL["AnnotationListeners\n(AnnotationListerners.java)"]:::obs
        Retry["Retry Logic\n(Retryfailedtc.java)"]:::obs
        TestInfo["Testinfo Listener\n(Testinfo.java)"]:::obs
        ExtentManager["ExtentManager\n(ExtentManager.java)"]:::obs
        ExtentReport["Report Builder\n(ExtentReport.java)"]:::obs
        ExtentLogger["Logger Helper\n(Extentlogger.java)"]:::obs
        HTMLReport["HTML Report\n(report.html)"]:::output
        LogsOut["Automation Logs\n(automation-log.log)"]:::output
    end

    %% External Systems
    subgraph "External Systems"
        BrowserDriver["Browser Drivers"]:::ext
        OTTApp["OTT Web Application"]:::ext
    end

    %% Connections
    Maven -->|"invokes"| TestNG
    TestNG -->|"runs suite"| BaseClass
    BaseClass -->|"calls readConfig()"| Factory
    Factory -->|"reads"| EnvProps
    Factory -->|"initializes"| ConfigReader

    BaseClass -->|"creates WebDriver"| BrowserDriver
    BrowserDriver -->|"navigates to"| OTTApp

    TCs -->|"use methods of"| POM
    POM -->|"send commands to"| BrowserDriver

    BaseClass -->|"logs via Log4j"| Log4jConfig
    Log4jConfig -->|"writes to"| LogsOut

    TestNG -->|"triggers events"| AnnotationL
    TestNG -->|"triggers events"| Retry
    TestNG -->|"triggers events"| TestInfo

    AnnotationL -->|"notifies"| ExtentManager
    Retry -->|"notifies"| ExtentManager
    TestInfo -->|"notifies"| ExtentManager

    ExtentManager -->|"builds report"| ExtentReport
    ExtentReport -->|"outputs"| HTMLReport

    TestNG -->|"generates"| Surefire

    %% Click Events
    click Maven "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/pom.xml"
    click TestNG "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/testng.xml"
    click Surefire "https://github.com/sarankumar-primesoft/webautomation/tree/master/OTT_automation/target/surefire-reports"
    click EnvProps "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/Configuration/config.properties"
    click Factory "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/configure/Factory.java"
    click ConfigReader "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/configure/config.java"
    click BaseClass "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/base/BaseClass.java"
    click Log4jConfig "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/main/resources/log4j2.xml"
    click AnnotationL "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/listeners/AnnotationListerners.java"
    click Retry "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/listeners/Retryfailedtc.java"
    click TestInfo "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/listeners/Testinfo.java"
    click ExtentManager "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/ExtentReport/ExtentManager.java"
    click ExtentReport "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/ExtentReport/ExtentReport.java"
    click ExtentLogger "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/src/test/java/com/ExtentReport/Extentlogger.java"
    click HTMLReport "https://github.com/sarankumar-primesoft/webautomation/blob/master/OTT_automation/extent-report/report.html"

    %% Styles
    classDef build fill:#D6EAF8,stroke:#3498DB,color:#154360
    classDef util fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef core fill:#EBF5FB,stroke:#5DADE2,color:#1B4F72
    classDef obs fill:#FCF3CF,stroke:#F4D03F,color:#7D6608
    classDef ext fill:#F2F3F4,stroke:#B3B6B7,color:#515A5A
    classDef output fill:#FEF9E7,stroke:#F8C471,color:#7E5109
```
