# atata-framework/atata architecture

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

- Interactive diagram: https://gitdiagram.com/atata-framework/atata
- Repository: https://github.com/atata-framework/atata

## Overview

This project is the Atata Framework – an open‐source, C#/.NET web UI test automation framework built on top of Selenium WebDriver. Its purpose is to simplify and standardize the process of writing, maintaining, and executing web UI tests by using a fluent page object pattern, built-in logging, a rich set of UI components, triggers, and integrations with multiple test engines such as NUnit, MSTest, and xUnit.

##### Main Components
- Core Library (Atata): This forms the heart of the framework and contains base classes, page objects, fluent APIs, and many utility functions (e.g., Context management, EventBus, Extensions, Components, and Verification).
- UI Components: A comprehensive library of ready-to-use components (buttons, inputs, tables, etc.) and support classes for control search, behaviors, and triggers.
- Logging & Reporting Modules: Multiple logging integrations (NLog, Log4Net, ExtentReports) and built-in logging abstractions along with screenshot/snapshot capabilities.
- Test Framework Adapters/Integrations: Separate sub-modules for integrations such as Atata.MSTest, Atata.NUnit, Atata.Xunit, and others that allow usage in different test engines.
- WebDriver Integration & Setup: Modules related to WebDriver management, such as browser session builders, driver wrappers, and event handling for WebDriver events.
- Data Provision and Context Management: Components that handle data input/sourcing, configuration of page contexts, session management, and artifact generation.
- Auxiliary Utilities and Extensions: Extensions (common helper methods), converters, object mapping, and type utilities spread throughout the “src/Atata” structure.
- Test Projects: The “test” directory includes integration, unit tests, and benchmarks – showing real usage of the framework in action.

##### Relationships and Interactions
- The Core Library serves as the central hub.
- UI Components and Page Objects consume base classes and utilities from the Core Library.
- Logging/Reporting modules subscribe to events produced by the Core Library (via Atata’s EventBus) and are used by test adapters.
- Test Framework Adapters interact with the Core Library to initialize test sessions (context setup, trigger registration, etc.) and wrap calls into the fluent API style.
- The WebDriver integration layer provides browser drivers to the Core’s context via builder patterns and event handling (e.g., WebDriver session builders, driver adapters).
- Data Provision services support binding runtime values into page objects and components.
- Integration tests (in the “test” folder) serve as a demonstration of how these layers work together.

##### Architectural Patterns and Principles
- Layered Architecture: Separation between UI components, core context/logic, integration adapters, and utilities.
- Plugin/Adapter Pattern: For logging, test framework integration, and WebDriver customization, allowing the framework to be extended based on the target environment.
- Fluent Interface & Page Object Model: To promote readability and ease of use in writing tests.
- Event-Driven Architecture: Using components like EventBus and triggers that hook into various lifecycle events of page object and session management.

##### Technologies and Frameworks
- .NET (targeting .NET Standard 2.0 and above).
- Selenium WebDriver as the underlying browser automation engine.
- Test engine integrations (NUnit, MSTest, xUnit).
- Logging frameworks: NLog, Log4Net, ExtentReports.
- Build and configuration tools (MSBuild, Azure Pipelines).

##### Detailing Essential Architectural Elements
- Central role of the fluent page object model and the fact that most functionalities are delivered as extension methods or through specific attribute-based components.
- Trigger mechanism, which is an important feature and extends the behavior of components.
- How the WebDriver abstraction and session management integrate with the core context.
- Subdivisions within the core if necessary, such as:
- Context Management (AtataContext, Context Scopes, and Sessions)
- UI Component Hierarchy (components, controls, and page objects)
- Event and Logging Bus (EventBus, logging consumers, and trigger event handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraph: Core Framework
    subgraph "Core Framework"
        AT["Atata Core"]:::core
    end

    %% Subgraph: UI Layer
    subgraph "UI Layer"
        UC["UI Components & Page Objects"]:::comp
    end

    %% Subgraph: Logging & Reporting Modules
    subgraph "Logging & Reporting Modules"
        ER["ExtentReports Integration"]:::integration
        NL["NLog Integration"]:::integration
        LN["Log4Net Integration"]:::integration
        GL["General Logging Utilities"]:::integration
    end

    %% Subgraph: Test Framework Adapters
    subgraph "Test Framework Adapters"
        MST["MSTest Adapter"]:::adapter
        NUN["NUnit Adapter"]:::adapter
        XU["xUnit Adapter"]:::adapter
        XU3["xUnit3 Adapter"]:::adapter
        RNN["Reqnroll NUnit Adapter"]:::adapter
    end

    %% Subgraph: WebDriver Integration & Setup
    subgraph "WebDriver Integration & Setup"
        WS["WebDriver Support"]:::integration
        BS["Browser/Session Builders"]:::integration
        WDS["WebDriver Setup"]:::integration
        WH["Web UI Helpers"]:::integration
    end

    %% Subgraph: Data & Context
    subgraph "Data & Context"
        DP["Data Provision"]:::utility
        CM["Context Management"]:::utility
    end

    %% Subgraph: Auxiliary Utilities
    subgraph "Auxiliary Utilities"
        EX["Extensions"]:::utility
        UT["Utilities"]:::utility
    end

    %% Subgraph: Test Projects
    subgraph "Test Projects"
        TP["Test Projects"]:::test
    end

    %% Connections between components
    UC -->|"consumes"| AT

    AT -->|"emits_events"| ER
    AT -->|"emits_events"| NL
    AT -->|"emits_events"| LN
    AT -->|"emits_events"| GL

    MST -->|"initialize"| AT
    NUN -->|"initialize"| AT
    XU -->|"initialize"| AT
    XU3 -->|"initialize"| AT
    RNN -->|"initialize"| AT

    MST -->|"logs"| GL
    NUN -->|"logs"| GL
    XU -->|"logs"| GL
    XU3 -->|"logs"| GL
    RNN -->|"logs"| GL

    BS -->|"builds"| WS
    WS -->|"integrates"| AT
    WDS -->|"configures"| AT
    WH -->|"supports"| AT

    DP -->|"provides"| AT
    CM -->|"manages"| AT

    AT -->|"extended_by"| EX
    AT -->|"extended_by"| UT

    TP -->|"runs"| MST
    TP -->|"runs"| NUN
    TP -->|"runs"| XU
    TP -->|"verifies"| AT

    %% Styles
    classDef core fill:#ffadad,stroke:#d00000,stroke-width:2px;
    classDef comp fill:#fdffb6,stroke:#e0a800,stroke-width:2px;
    classDef integration fill:#caffbf,stroke:#008000,stroke-width:2px;
    classDef adapter fill:#ffd6a5,stroke:#ff6700,stroke-width:2px;
    classDef utility fill:#9bf6ff,stroke:#0077b6,stroke-width:2px;
    classDef test fill:#a0c4ff,stroke:#4361ee,stroke-width:2px;

    %% Click Events
    click AT "https://github.com/atata-framework/atata/tree/main/src/Atata"
    click UC "https://github.com/atata-framework/atata/tree/main/src/Atata/Components"
    click ER "https://github.com/atata-framework/atata/blob/main/src/Atata.ExtentReports"
    click NL "https://github.com/atata-framework/atata/blob/main/src/Atata.NLog"
    click LN "https://github.com/atata-framework/atata/tree/main/src/Atata/Log4Net"
    click GL "https://github.com/atata-framework/atata/tree/main/src/Atata/Logging"
    click MST "https://github.com/atata-framework/atata/blob/main/src/Atata.MSTest"
    click NUN "https://github.com/atata-framework/atata/blob/main/src/Atata.NUnit"
    click XU "https://github.com/atata-framework/atata/blob/main/src/Atata.Xunit"
    click XU3 "https://github.com/atata-framework/atata/blob/main/src/Atata.Xunit3"
    click RNN "https://github.com/atata-framework/atata/blob/main/src/Atata.Reqnroll.NUnit"
    click WS "https://github.com/atata-framework/atata/tree/main/src/Atata/WebDriver"
    click BS "https://github.com/atata-framework/atata/tree/main/src/Atata/WebDriver/Builders"
    click WDS "https://github.com/atata-framework/atata/tree/main/src/Atata/WebDriverSetup"
    click WH "https://github.com/atata-framework/atata/tree/main/src/Atata/Web"
    click DP "https://github.com/atata-framework/atata/tree/main/src/Atata/DataProvision"
    click CM "https://github.com/atata-framework/atata/tree/main/src/Atata/Context"
    click EX "https://github.com/atata-framework/atata/tree/main/src/Atata/Extensions"
    click UT "https://github.com/atata-framework/atata/tree/main/src/Atata/Utils"
    click TP "https://github.com/atata-framework/atata/tree/main/test/"
```
