# stonefly365/selenium-webdriver architecture

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

- Interactive diagram: https://gitdiagram.com/stonefly365/selenium-webdriver
- Repository: https://github.com/stonefly365/selenium-webdriver

## Overview

##### Main Components
- Test Runner Layer: Represented by the TestRunner.java class in the "src/test/java/runner" directory. This is the entry point that triggers test execution.
- Step Definitions: Located in "src/test/java/steps". These classes (e.g., FreeRangeSteps.java) translate the high-level Gherkin steps into executable test commands.
- Page Objects: Found in "src/test/java/pages" (e.g., BasePage.java, PaginaCursos.java, etc.). These encapsulate the UI elements and actions for different parts of the web application under test.
- Feature Files: In "src/test/resources/features". They contain the Gherkin scenarios that define the test cases.
- Selenium WebDriver / ChromeDriver: The framework uses Selenium WebDriver with ChromeDriver (present in the "chromedriver_win32/" directory) to interact with the browser.
- Build and Configuration: Gradle build configuration files (build.gradle, gradlew, gradlew.bat, settings.gradle) that manage dependencies and test executions.

##### System Relationships and Interactions
- The Test Runner initializes the test session that orchestrates:
- Loading and interpreting the feature files.
- Mapping Gherkin steps to their corresponding step definitions.
- Step Definitions interact with Page Objects; each step usually calls a method defined in one of the Page Object classes.
- Page Objects use Selenium WebDriver to interact with the web application (e.g., finding elements, clicking, navigating).
- The ChromeDriver executable serves as the concrete implementation that allows the Selenium WebDriver to drive the Chrome browser.
- Gradle’s build system orchestrates the build lifecycle, from compiling code to running tests and generating reports (e.g., Cucumber reports in "target/cucumber-reports").

##### Architectural Patterns and Design Principles
- Page Object Model (POM): Evident from the "pages" package, ensuring that UI interactions are abstracted away from test logic.
- Layered Architecture: Separation between test runner, step definitions, and page objects creates clear boundaries.
- BDD (Behavior Driven Development) Integration: Use of Gherkin feature files and Cucumber enhances readability and maintainability.

##### Relevant Technologies, Frameworks, and Libraries
- Selenium WebDriver for browser automation.
- Cucumber for parsing and executing feature files.
- Gradle as the build tool.
- Java as the programming language.
- ChromeDriver as the browser automation driver.

## Diagram (Mermaid)

```mermaid
flowchart TD
    buildSys["Build System (Gradle)"]:::build
    features["Feature Files\n(src/test/resources/features)"]:::feature
    testRunner["Test Runner\n(src/test/java/runner/TestRunner.java)"]:::runner
    stepDefs["Step Definitions\n(src/test/java/steps)"]:::step
    pageObjects["Page Objects\n(src/test/java/pages)"]:::page
    selenium["Selenium WebDriver"]:::webdriver
    chrome["ChromeDriver\n(chromedriver_win32)"]:::webdriver

    buildSys -->|"orchestrates"| testRunner
    features -->|"provides"| testRunner
    testRunner -->|"maps"| stepDefs
    stepDefs -->|"calls"| pageObjects
    pageObjects -->|"invokes"| selenium
    selenium -->|"uses"| chrome

    click buildSys "https://github.com/stonefly365/selenium-webdriver/blob/master/build.gradle"
    click features "https://github.com/stonefly365/selenium-webdriver/tree/master/src/test/resources/features"
    click testRunner "https://github.com/stonefly365/selenium-webdriver/blob/master/src/test/java/runner/TestRunner.java"
    click stepDefs "https://github.com/stonefly365/selenium-webdriver/blob/master/src/test/java/steps/FreeRangeSteps.java"
    click pageObjects "https://github.com/stonefly365/selenium-webdriver/tree/master/src/test/java/pages"
    click chrome "https://github.com/stonefly365/selenium-webdriver/blob/master/chromedriver_win32/chromedriver.exe"

    classDef feature fill:#f5f0a3,stroke:#333,stroke-width:2px;
    classDef runner fill:#a3c8f5,stroke:#333,stroke-width:2px;
    classDef step fill:#a3f5a3,stroke:#333,stroke-width:2px;
    classDef page fill:#f5a3e4,stroke:#333,stroke-width:2px;
    classDef webdriver fill:#f5d0a3,stroke:#333,stroke-width:2px;
    classDef build fill:#c8a3f5,stroke:#333,stroke-width:2px;
```
