# ing-bank/mint architecture

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

- Interactive diagram: https://gitdiagram.com/ing-bank/mint
- Repository: https://github.com/ing-bank/mint

## Overview

##### Main Components
- Core Engine (core module): Contains the central libraries (MintLoop, MintRun, MintServer, Reporter, StateRepository, etc.) and defines the basic types for oracles, probes, rules, queries, and their orchestration. This module underpins the whole system.
- Android Core (android-core module): Provides Android-specific implementations, utility classes, and integration with native Android components. This is where most UI–specific logic is implemented (e.g., Espresso integration, Android probes, and android-specific rules such as for accessibility).
- API Module (api): Offers public API abstractions (such as MINT, MINTApi, and MINTRule) and integrations with JUnit (test runners like MintClassRunner and MintTestRunner) to facilitate automated test execution.
- Espresso Runner (espresso-runner module): A specialized test runner built on top of Espresso. It contains components for executing interactions, capturing screenshots, and gathering Android device state. It is focused on running “live” tests on Android and translating test actions to Espresso actions.
- Integration Test Runner (integration-test-runner module): Another runner module designed to aggregate and execute integration tests within the MINT framework.
- Tooling (tooling module): Provides supplementary tasks for device management (e.g., ADB commands, report rendering, cleaning device states) and report generation. This module supports the test execution infrastructure by automating side tasks and post-processing.
- Demo App (app module) and sample application in core/android-core tests: A demonstration Android application that serves as a testing target for the tool, showcasing how to integrate MINT into a sample project.

##### Detail the Relationships and Interactions Between Components
- At the heart of the system lies the Core Engine. This component orchestrates test runs, handles state management, and issues commands based on the selected rules (which are defined in libraries such as the android-core and core modules).
- The Android Core module interacts with the platform’s UI components; it encapsulates Android-specific functionality (including state observations, testing probes, and oracles for accessibility or logging).
- The API module exposes an abstraction for test definitions and integrates with standard testing frameworks (JUnit), enabling communication between test definitions and the test execution modules.
- The Espresso Runner and Integration Test Runner modules serve as entry points for executing tests. They integrate with the Android Core and use the components provided by the Core Engine to initiate automated tests.
- The Tooling module runs in parallel to support the test runners by offering build tasks, device management functionalities, and reporting capabilities.

##### Recognize Architectural Patterns and Technologies
- Modularity: The project is highly modular – separating concerns into core libraries, Android-specific implementations, test runners, and tooling.
- Layered Architecture: There is a clear divide between the “business logic” layer (Core Engine, API) and the “platform-specific” layer (Android Core, Espresso Runner, Integration Test Runner).
- Plug & Play Extensibility: The use of rules, probes, and oracles, as described in the README, points to an architecture where components can be added or exchanged for customization.
- Test Automation Framework Design: Incorporates principles similar to those in the TESTAR framework, with an emphasis on automated exploration and stateful analysis.

##### Elements
- Blocks labeled “Core Engine” (core) with sub-components such as MintLoop, MintRun, Reporter, etc.
- A block for “Android Core” showing Android–specific UI testing functions, oracles (e.g., Accessibility, crash, logging oracles), and rule enforcement.
- Blocks for “API Module” (exposing MINTApi and MINTRule) with a clear link to the JUnit integration layer (including MintClassRunner and MintTestRunner).
- A “Tooling” block with tasks like ADB commands, report renderer, and device state cleaning.
- A “Demo App” (or sample application) block that represents the target application against which tests are run.
- Data flow from core to runners and vice versa.
- Control flow from API to the Core Engine.
- Dependency and support links from Tooling to both test runners.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Layer 1: Test Definition"
        API["API Module"]:::core
    end

    subgraph "Layer 2: Core Orchestration"
        CORE["Core Engine"]:::core
    end

    subgraph "Layer 3: Android Integration"
        ANDROID["Android Core"]:::core
    end

    subgraph "Layer 4: Test Execution"
        ER["Espresso Runner"]:::runner
        ITR["Integration Test Runner"]:::runner
    end

    subgraph "Layer 5: Target & Support"
        DEMO["Demo App"]:::demo
        TOOL["Tooling"]:::tooling
    end

    API -->|"API_Calls"| CORE
    CORE -->|"Test_Commands"| ER
    CORE -->|"Test_Commands"| ITR
    CORE -->|"UI_Interaction"| ANDROID
    ER -->|"UI_Actions"| ANDROID
    ITR -->|"UI_Actions"| ANDROID
    TOOL -->|"Reporting_Data"| ER
    TOOL -->|"Reporting_Data"| ITR
    ER -->|"Executes_on"| DEMO
    ITR -->|"Executes_on"| DEMO
    API -->|"JUnit_Integration"| ER
    API -->|"JUnit_Integration"| ITR

    click CORE "https://github.com/ing-bank/mint/blob/main/core/src/main/kotlin/org/mint/MintLoop.kt"
    click ANDROID "https://github.com/ing-bank/mint/tree/main/android-core/src/main/kotlin/org/mint/android"
    click API "https://github.com/ing-bank/mint/blob/main/api/src/main/kotlin/org/mint/MINT.kt"
    click ER "https://github.com/ing-bank/mint/blob/main/espresso-runner/EspressoLoop.kt"
    click ITR "https://github.com/ing-bank/mint/blob/main/integration-test-runner/ITTestLoop.kt"
    click TOOL "https://github.com/ing-bank/mint/blob/main/tooling/ToolingPlugin.kt"
    click DEMO "https://github.com/ing-bank/mint/tree/main/app"

    classDef core fill:#8dd3c7,stroke:#000,stroke-width:2px;
    classDef runner fill:#fb8072,stroke:#000,stroke-width:2px,stroke-dasharray: 5,5;
    classDef tooling fill:#ffffb3,stroke:#000,stroke-width:2px;
    classDef demo fill:#bebada,stroke:#000,stroke-width:2px;
```
