# partheebanmani/selenium_cucumber_pom architecture

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

- Interactive diagram: https://gitdiagram.com/partheebanmani/selenium_cucumber_pom
- Repository: https://github.com/partheebanmani/selenium_cucumber_pom

## Overview

##### Main components
- Test Orchestration
- TestNG Runner (RunnerTest.java)
- Cucumber Engine (hooks into TestNG via Maven)
- Feature/Step Layer
- Gherkin Feature Files (src/test/resources/*.feature)
- Step Definitions (src/test/java/.../stepdefinitions)
- Test Context & Data
- TestContext (holds per-scenario state)
- PropertiesConfig & TestEnv (env config)
- UI Automation Layer
- Page Objects (BasePage, Login, Inventory, ProductInformation)
- Driver Management
– DriverFactory, DriverManager, BaseDriver
– BrowserProviders (Chrome, Firefox, Safari)
– Enums (Browsers) and Exceptions (BrowserNotSupported)
- SeleniumUtility (common browser ops)
- API Automation Layer
- RestAssuredUtility (HTTP calls)
- APIUrl & JsonFields (constants)
- Models/BaseModel & specific models (User, Employee, Cat)
- Utilities & Infrastructure
- KafkaUtility (if testing messaging flows)
- Util (generic helpers)
- PropertiesConverter (TestEnvConverter)
- External Systems
- Application Under Test (SauceDemo UI)
- REST endpoints under test
- Dockerized Selenium Grid (Hub + Node containers)

##### Relationships & data flow
- The TestNG runner invokes Cucumber, which in turn reads Feature files.
- For each Gherkin step, the Cucumber Engine calls a Step Definition.
- Step Definitions use TestContext to share data and then invoke either:
- UI path: Page Objects → SeleniumUtility → DriverManager → Selenium Grid → Browser → SauceDemo
- API path: RestAssuredUtility → HTTP Request → Target API → JSON response → Models
- DriverFactory selects the right BrowserProvider based on -Dbrowser or -Dbrowser.env.
- Configuration is loaded at startup (PropertiesConfig, TestEnvConverter).
- Parallel execution is orchestrated by TestNG + Docker Grid.

##### Architectural patterns & principles
- Page Object Model: separates page-specific logic from tests
- Factory Pattern: DriverFactory abstracts browser instantiation
- Singleton-ish Context: TestContext maintains state across steps
- BDD Layer: clear separation of “what” (Feature files) vs. “how” (StepDefs)
- Layered Structure:
- Presentation/Test Layer
- Domain/Model Layer
- Infrastructure Layer

##### Technologies & frameworks to annotate
- Java + Maven
- TestNG
- Cucumber BDD
- Selenium WebDriver + Docker Selenium Grid
- Rest Assured
- AssertJ for assertions
- KafkaUtility (if applicable)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Test Orchestration Layer
    subgraph "Test Orchestration"
        Runner["TestNG Runner\nRunnerTest.java"]:::orch
        Cucumber["Cucumber Engine"]:::orch
    end
    Runner --> Cucumber

    %% Feature & Step Layer
    subgraph "Feature & Step Layer"
        Features["Gherkin Feature Files"]:::feature
        Steps["Step Definitions"]:::feature
    end
    Cucumber --> Features
    Features --> Steps

    %% Test Context & Configuration
    subgraph "Test Context & Configuration"
        Context["TestContext"]:::config
        Props["PropertiesConfig"]:::config
        Env["TestEnv"]:::config
        Converter["TestEnvConverter"]:::config
    end
    Steps --> Context
    Context --> Props
    Context --> Env
    Env --> Converter

    %% UI Automation Layer
    subgraph "UI Automation Layer"
        subgraph "Page Objects"
            BasePage["BasePage"]:::ui
            Login["Login"]:::ui
            Inventory["Inventory"]:::ui
            ProductInfo["ProductInformation"]:::ui
        end
        subgraph "Driver Management"
            BaseDriver["BaseDriver"]:::ui
            DriverFactory["DriverFactory"]:::ui
            DriverManager["DriverManager"]:::ui
            subgraph "Providers"
                ChromeProv["ChromeDriverProvider"]:::ui
                FirefoxProv["FirefoxDriverProvider"]:::ui
                SafariProv["SafariDriverProvider"]:::ui
            end
            BrowsersEnum["Browsers"]:::ui
            BrowserEx["BrowserNotSupportedException"]:::ui
        end
        SeleniumUtil["SeleniumUtility"]:::ui
    end
    Steps --> BasePage
    BasePage --> Login
    BasePage --> Inventory
    BasePage --> ProductInfo
    Steps --> SeleniumUtil
    SeleniumUtil --> DriverManager
    DriverManager --> DriverFactory
    DriverFactory --> ChromeProv
    DriverFactory --> FirefoxProv
    DriverFactory --> SafariProv

    %% API Automation Layer
    subgraph "API Automation Layer"
        RestUtil["RestAssuredUtility"]:::api
        APIConsts["APIUrl & JsonFields"]:::api
        Models["Domain Models"]:::api
    end
    Steps --> RestUtil
    RestUtil --> APIConsts
    APIConsts --> Models

    %% Utilities & Infrastructure
    subgraph "Utilities & Infrastructure"
        KafkaUtil["KafkaUtility"]:::infra
        GenUtil["Util"]:::infra
        ConvInfra["PropertiesConverter"]:::infra
    end
    Context --> KafkaUtil
    Context --> GenUtil
    Context --> ConvInfra

    %% Infrastructure
    subgraph "Infrastructure"
        subgraph "Dockerized Selenium Grid"
            Hub["Grid Hub"]:::infra
            Node1["Grid Node"]:::infra
            Node2["Grid Node"]:::infra
        end
    end
    DriverManager --> Hub
    Hub --> Node1
    Hub --> Node2
    Node1 --> Browser["Browser Instance"]:::infra
    Node2 --> Browser

    %% External Systems
    subgraph "External Systems"
        SUT["SauceDemo UI"]:::external
        APIService["Target REST API"]:::external
    end
    Browser --> SUT
    RestUtil --> APIService

    %% Parallel execution annotation
    Runner -->|parallel| Node1
    Runner -->|parallel| Node2

    %% Click Events
    click Runner "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/test/java/RunnerTest.java"
    click Features "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/test/resources/com.partheeban/*.feature"
    click Steps "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/test/java/com/partheeban/stepdefinitions/*.java"
    click Context "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/container/TestContext.java"
    click Props "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/PropertiesConfig.java"
    click Env "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/TestEnv.java"
    click Converter "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/propertiesconverter/TestEnvConverter.java"
    click BasePage "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/pages/BasePage.java"
    click Login "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/pages/Login.java"
    click Inventory "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/pages/Inventory.java"
    click ProductInfo "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/pages/ProductInformation.java"
    click BaseDriver "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/BaseDriver.java"
    click DriverFactory "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/DriverFactory.java"
    click DriverManager "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/DriverManager.java"
    click ChromeProv "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/ChromeDriverProvider.java"
    click FirefoxProv "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/FirefoxDriverProvider.java"
    click SafariProv "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/drivers/SafariDriverProvider.java"
    click BrowsersEnum "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/enums/Browsers.java"
    click BrowserEx "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/exceptions/BrowserNotSupportedException.java"
    click SeleniumUtil "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/SeleniumUtility.java"
    click RestUtil "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/RestAssuredUtility.java"
    click APIConsts "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/constants/APIUrl.java"
    click Models "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/model/BaseModel.java"
    click KafkaUtil "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/KafkaUtility.java"
    click GenUtil "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/Util.java"
    click ConvInfra "https://github.com/partheebanmani/selenium_cucumber_pom/blob/main/src/main/java/com/partheeban/utility/propertiesconverter/TestEnvConverter.java"

    %% Styles
    classDef orch fill:#AED6F1,stroke:#1F618D,color:#1B2631;
    classDef feature fill:#A9DFBF,stroke:#196F3D,color:#1B2631;
    classDef config fill:#F9E79F,stroke:#B7950B,color:#1B2631;
    classDef ui fill:#F5B7B1,stroke:#922B21,color:#1B2631;
    classDef api fill:#D2B4DE,stroke:#6C3483,color:#1B2631;
    classDef infra fill:#D5DBDB,stroke:#575756,color:#1B2631;
    classDef external fill:#FFFFFF,stroke-dasharray: 5 5,stroke:#7B7D7D,color:#1B2631;
```
