# cvenkatreddy/python-selenium-pytest architecture

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

- Interactive diagram: https://gitdiagram.com/cvenkatreddy/python-selenium-pytest
- Repository: https://github.com/cvenkatreddy/python-selenium-pytest

## Overview

##### Project type and purpose
- This is not a user‐facing app but a test automation framework built in Python. It uses Selenium WebDriver to automate browser actions, Pytest as the test runner, and Allure for reporting. The goal is to provide a maintainable, data‐driven UI testing solution with clear separation of concerns.

##### File structure
- Top‐level directories:
- data/               ← JSON files containing test data
- globals/            ← global constants and directory paths
- ini_configs/        ← INI configuration files (e.g., environment URLs, credentials)
- pages/              ← Page Object Model classes (base_page.py, sign_page.py)
- tests/              ← Pytest test modules and fixtures (conftest.py, test_*.py)
- utils/              ← helper modules (config_parser.py, json_parser.py)
- CI/CD integration: .github/workflows/python-app.yml triggers tests in GitHub Actions
- Requirements.txt / pipenv manage dependencies; Allure CLI for report generation

##### README for additional insights
- Describes environment setup (scoop/brew, pipenv, venv)
- Shows Pytest commands and browser options (chrome, firefox, remote)
- Mentions Allure as the reporting engine

a. Main components to represent:
1. **CI/CD Pipeline** (GitHub Actions)
2. **Test Runner** (Pytest)
3. **Test Suite** (tests/ modules + conftest fixtures)
4. **Configuration Layer**
- INI configs (ini_configs/props.ini)
- globals (globals/dir_global.py)
5. **Data Layer** (data/tests_data.json)
6. **Utility Layer** (utils/config_parser.py, utils/json_parser.py)
7. **Page Object Layer** (pages/base_page.py, pages/sign_page.py)
8. **Selenium WebDriver** (local or remote browser)
9. **Reporting** (Allure CLI / allure-results → Allure Report)
10. **External Services** (e.g., remote Selenium Grid or cloud browser)

b. Relationships and interactions:
- CI/CD Pipeline → triggers Pytest Test Runner
- Test Runner loads Conftest fixtures → reads from Configuration + Globals
- Tests call Utility Layer to parse INI and JSON data → supply parameters to tests
- Tests use Page Objects to perform UI steps → Page Objects invoke Selenium WebDriver APIs
- WebDriver sends commands to the Browser (local or remote) → returns DOM/state
- Test results are captured by Pytest → output raw results to Allure results directory
- Allure CLI reads results → generates interactive HTML report

c. Architectural patterns / design principles:
- **Page Object Model**: encapsulates locators and actions in page classes
- **Layered architecture**: clear separation between Test, Page, Utility, Data, Configuration
- **Configuration-driven**: environment and test data externalized (INI + JSON)
- **Plugin-based reporting**: Pytest + Allure integration

d. Key technologies/frameworks:
- Python 3.x, Pytest, Selenium WebDriver, Allure CLI
- pipenv/virtualenv for dependency management
- GitHub Actions for CI/CD

## Diagram (Mermaid)

```mermaid
graph TB
    %% CI/CD Layer
    CICD["GitHub Actions Pipeline"]:::testblue
    click CICD "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/.github/workflows/python-app.yml"

    %% Test Runner
    Runner["Pytest Runner"]:::testblue
    click Runner "https://github.com/cvenkatreddy/python-selenium-pytest/tree/main/tests/"

    CICD -->|"triggers"| Runner

    %% Test Suite
    subgraph "Test Suite"
        Conftest["conftest.py"]:::testblue
        TestBase["test_base.py"]:::testblue
        TestSign["test_sign.py"]:::testblue
        click Conftest "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/tests/conftest.py"
        click TestBase "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/tests/test_base.py"
        click TestSign "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/tests/test_sign.py"
    end

    Runner -->|"loads tests"| Conftest
    Conftest --> TestBase
    Conftest --> TestSign

    %% Configuration & Data Layer
    subgraph "Configuration & Data Layer"
        INI["props.ini"]:::configgreen
        Globals["dir_global.py"]:::configgreen
        DataJSON["tests_data.json"]:::configgreen
        click INI "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/ini_configs/props.ini"
        click Globals "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/globals/dir_global.py"
        click DataJSON "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/data/tests_data.json"
    end

    Conftest -->|"reads config"| INI
    Conftest -->|"reads globals"| Globals
    TestBase -->|"loads data"| DataJSON
    TestSign -->|"loads data"| DataJSON

    %% Utility Layer
    subgraph "Utility Layer"
        ConfigParser["config_parser.py"]:::utility
        JSONParser["json_parser.py"]:::utility
        click ConfigParser "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/utils/config_parser.py"
        click JSONParser "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/utils/json_parser.py"
    end

    INI -->|"parse_config()"| ConfigParser
    Globals -->|"parse_globals()"| ConfigParser
    DataJSON -->|"parse_json()"| JSONParser
    TestBase -->|"uses util"| ConfigParser
    TestBase -->|"uses util"| JSONParser
    TestSign -->|"uses util"| ConfigParser
    TestSign -->|"uses util"| JSONParser

    %% Page Object Layer
    subgraph "Page Object Layer"
        BasePage["base_page.py"]:::pageyellow
        SignPage["sign_page.py"]:::pageyellow
        click BasePage "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/pages/base_page.py"
        click SignPage "https://github.com/cvenkatreddy/python-selenium-pytest/blob/main/pages/sign_page.py"
    end

    ConfigParser -->|"provides config"| BasePage
    JSONParser -->|"provides data"| SignPage
    TestBase -->|"calls actions"| BasePage
    TestSign -->|"calls actions"| SignPage

    %% WebDriver & Browsers
    WebDriver["Selenium WebDriver"]:::external
    LocalBrowser["Local Browser"]:::external
    RemoteBrowser["Selenium Grid / Browser Cloud"]:::external

    BasePage -->|"invoke WebDriver API"| WebDriver
    SignPage -->|"invoke WebDriver API"| WebDriver
    WebDriver -->|"executes commands"| LocalBrowser
    WebDriver -->|"executes commands"| RemoteBrowser

    %% Reporting
    AllureResults["Allure Results"]:::reportgray
    AllureReport["Allure Report"]:::reportgray

    Runner -->|"outputs results"| AllureResults
    AllureResults -->|"generate report"| AllureReport

    classDef testblue fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef configgreen fill:#d4edda,stroke:#333,stroke-width:1px
    classDef utility fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef pageyellow fill:#ffeeba,stroke:#333,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px
    classDef reportgray fill:#e2e3e5,stroke:#333,stroke-width:1px
```
