# cmccarthyirl/spring-cucumber-testng-parallel-test-harness architecture

> Architecture diagram of the GitHub repository cmccarthyirl/spring-cucumber-testng-parallel-test-harness, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness
- Repository: https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness

## Overview

##### Main Components
- Common Module: Acts as the shared library for the entire framework. It contains utility classes (for string manipulation, date/time, logging, and custom event evaluation), service classes (e.g., for REST calls), property configuration (various application-*.properties files), and resource files (XML/Extent configuration, demo screenshots). It is the backbone where the central configuration (like the “FrameworkContextConfiguration” class) is defined.
- Weather Module: Focused on API tests, this module uses Rest Assured to test weather-related API endpoints. It includes test runners (WeatherRunnerTest), configuration classes, API models (POJO classes like Clouds.java, Coord.java, etc.), and service classes to interact with API endpoints.
- Wikipedia Module: Focused on UI tests, this module leverages Selenium WebDriver. It has its own test runner (WikipediaParallelRunnerTest), page objects (e.g., AbstractPage, WikipediaHomePage), UI step definitions, and driver management utilities (DriverHelper, DriverManager, etc.). It also includes custom expected conditions that help drive UI interactions.

##### Relationships and Interactions
- Test Execution: At runtime, TestNG (via dedicated test runner classes in both weather and wikipedia modules) directs the tests. Test classes are annotated with Cucumber options so that feature files are executed.
- Step Definitions and Hooks: Step definitions (within packages such as “api/step” or “ui/step”) implement test behavior using Cucumber and are hooked into Spring Boot Test via the “FrameworkContextConfiguration”. Hooks (in the “Hooks.java” classes) are used for “before” and “after” test run operations—like driver initialization and logging.
- Dependency Injection & Shared Services: The Spring context loaded from common configuration allows shared utilities and service classes (from the common module) to be available to both API and UI test modules.
- Reporting & Logging: Throughout the test execution, results are logged (using LogManager and external logging libraries) and captured by reporting tools such as Allure and Extent Reports.

##### Architectural Patterns and Design Principles
- Modular Design: The separation into common, weather, and wikipedia modules reinforces a modular architecture, which simplifies maintenance and scalability.
- BDD (Behavior Driven Development): Using Cucumber, tests are written in natural language feature files that are then mapped to Java step definitions.
- Separation of Concerns: API tests (weather) and UI tests (wikipedia) keep responsibilities separate while sharing common services and configuration.
- Dependency Injection: The use of Spring Boot Test with its context configuration highlights dependency inversion and loose coupling across modules.

## Diagram (Mermaid)

```mermaid
graph TD
    A["Maven Build & Profiles"]:::maven
    B["TestNG Executor"]:::testExec
    A --> B

    subgraph "Common Module (Shared Services)"
        C1["Common Utils"]:::common
        C2["Common Services"]:::common
        C3["Common Config & Logging"]:::common
        D["Spring Context & Dependency Injection"]:::common
        C1 --> D
        C2 --> D
        C3 --> D
    end

    subgraph "Weather Module (API Testing)"
        W1["Weather Runner"]:::api
        W2["Weather Configuration"]:::api
        W3["Weather Step Definitions & Hooks"]:::api
        W4["Rest Assured"]:::external
        W1 --> W2
        W1 --> W3
        W3 --> D
        W1 -->|"Uses"| W4
    end

    subgraph "Wikipedia Module (UI Testing)"
        WP1["Wikipedia Runner"]:::ui
        WP2["Wikipedia Configuration"]:::ui
        WP3["Wikipedia Step Definitions & Hooks"]:::ui
        WP4["Wikipedia Page Objects"]:::ui
        WP5["Driver Management Utilities"]:::ui
        WP6["Selenium WebDriver"]:::external
        WP1 --> WP2
        WP1 --> WP3
        WP3 --> D
        WP4 --> WP5
        WP5 -->|"Controls"| WP6
    end

    B --> W1
    B --> WP1

    R["Reporting Tools (Extent Reports, Allure)"]:::report
    L["Logging (Logback/Log4j2)"]:::report
    W1 --> R
    WP1 --> R
    W1 --> L
    WP1 --> L

    style A fill:#ffcc00,stroke:#333,stroke-width:2px
    style B fill:#dda0dd,stroke:#333,stroke-width:2px
    style D fill:#ffdead,stroke:#333,stroke-width:2px
    style R fill:#98fb98,stroke:#333,stroke-width:2px
    style L fill:#98fb98,stroke:#333,stroke-width:2px

    classDef maven fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef testExec fill:#dda0dd,stroke:#333,stroke-width:2px;
    classDef common fill:#ffdead,stroke:#333,stroke-width:2px;
    classDef api fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef ui fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef external fill:#f08080,stroke:#333,stroke-width:2px;
    classDef report fill:#98fb98,stroke:#333,stroke-width:2px;

    click C1 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/common/src/main/java/com/cmccarthy/common/utils"
    click C2 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/common/src/main/java/com/cmccarthy/common/service"
    click C3 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/common/src/main/resources"
    click W1 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/blob/master/weather/src/test/java/com/cmccarthy/api/WeatherRunnerTest.java"
    click W2 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/weather/src/test/java/com/cmccarthy/api/config"
    click W3 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/weather/src/test/java/com/cmccarthy/api/step"
    click WP1 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/blob/master/wikipedia/src/test/java/com/cmccarthy/ui/WikipediaParallelRunnerTest.java"
    click WP2 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/wikipedia/src/test/java/com/cmccarthy/ui/config"
    click WP4 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/wikipedia/src/test/java/com/cmccarthy/ui/page"
    click WP3 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/wikipedia/src/test/java/com/cmccarthy/ui/step"
    click WP5 "https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness/tree/master/wikipedia/src/test/java/com/cmccarthy/ui/utils"
```
