# rndsolutions/trx-merger architecture

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

- Interactive diagram: https://gitdiagram.com/rndsolutions/trx-merger
- Repository: https://github.com/rndsolutions/trx-merger

## Overview

##### Project type and purpose
- This is a .NET console (command-line) utility whose sole responsibility is to ingest multiple VSTest “.trx” XML test-result files, merge them into one combined “.trx” file, and optionally produce an HTML report. It is an open-source tool focused on test-report aggregation and rendering.

##### File structure
- Top‐level:
- TRX_Merger.sln / .csproj – the Visual Studio solution/project (console app).
- Program.cs – entry point, CLI argument parsing and orchestration.
- TestRunMerger.cs – core merging logic.
- Properties\AssemblyInfo.cs – metadata.
- packages.config – NuGet dependencies.
- Subdirectories:
- TrxModel – domain classes matching the TRX XML schema (e.g., TestRun, UnitTest, ErrorInfo).
- ReportModel – simplified report objects (TestRunReport, TestClassReport).
- ReportGenerator – takes ReportModel objects + HTML template → writes HTML.
- Utilities – helper/extension methods & XML (de)serialization utilities.

##### README for additional insights
- It describes CLI parameters (/trx, /output, /report, /r), usage examples, and indicates that a built-in HTML template is used for report generation.

##### Diagramming conventions
- Another for processing engines (Merger, Generator).
- A third for infrastructure (File I/O, Utilities).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User invocation
    User["User"]:::external
    CLI["CLI Parser (/trx, /output, /report)"]:::presentation
    FileSys["File System Explorer"]:::infra

    %% Infrastructure services
    subgraph "Infrastructure"
        TRXSer["TRX Serializer/Deserializer"]:::infra
        Utils["Extension Methods & XML Helpers"]:::infra
    end

    %% Domain Model
    subgraph "Domain Model"
        TrxModel["In-Memory Domain Model\n(TrxModel)"]:::domain
        Combined["Combined TestRun"]:::domain
    end

    %% Processing engines
    Merger["Merger Engine\n(TestRunMerger)"]:::processing

    %% Reporting
    subgraph "Reporting"
        RepModel["Report Model Builder\n(ReportModel)"]:::domain
        HTMLGen["HTML Report Generator\n(TrxReportGenerator)"]:::processing
        Template["Built-in HTML Template"]:::infra
    end

    %% Outputs
    subgraph "Outputs"
        OutTrx["Combined .trx File"]:::output
        OutHtml["HTML Report"]:::output
    end

    %% Project definition
    Proj["Solution & Project\n(TRX_Merger.sln, TRX_Merger.csproj)"]:::infra

    %% Connections
    User --> CLI
    CLI --> FileSys
    FileSys -->|list of .trx paths| TRXSer
    Utils --> TRXSer
    TRXSer -->|deserialize XML| TrxModel
    TrxModel --> Merger
    Merger -->|merged model| Combined
    Combined --> TRXSer
    TRXSer -->|serialize merged| OutTrx
    Combined --> RepModel
    RepModel --> HTMLGen
    HTMLGen -->|apply template| Template
    HTMLGen --> OutHtml

    %% Click Events
    click CLI "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/Program.cs"
    click FileSys "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/Program.cs"
    click TRXSer "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/Utilities/TRXSerializationUtils.cs"
    click Utils "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/Utilities/ExtensionMethods.cs"
    click TrxModel "https://github.com/rndsolutions/trx-merger/tree/master/TRX_Merger/TrxModel"
    click Merger "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/TestRunMerger.cs"
    click RepModel "https://github.com/rndsolutions/trx-merger/tree/master/TRX_Merger/ReportModel"
    click HTMLGen "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/ReportGenerator/TrxReportGenerator.cs"
    click Template "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/ReportGenerator/trx_report_template.html"
    click Proj "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger/TRX_Merger.csproj"
    click Proj "https://github.com/rndsolutions/trx-merger/blob/master/TRX_Merger.sln"

    %% Styles
    classDef external fill:#ffe4b2,stroke:#cc7a00,color:#000
    classDef presentation fill:#cce5ff,stroke:#00529b,color:#000
    classDef infra fill:#f0f0f0,stroke:#666,color:#000
    classDef domain fill:#d4edda,stroke:#155724,color:#000
    classDef processing fill:#fff3cd,stroke:#856404,color:#000
    classDef output fill:#f8d7da,stroke:#721c24,color:#000
```
