# tmahm/htektesttools architecture

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

- Interactive diagram: https://gitdiagram.com/tmahm/htektesttools
- Repository: https://github.com/tmahm/htektesttools

## Overview

##### Project Type and Purpose
- This is an automation testing framework (Robot Framework-based) for Htek VoIP phones.
- Purpose: define phone behaviors, drive call/upgrade scenarios, collect logs & reports.

##### File Structure
- Top‑level components:
- config/ – global + user configs
- phoneFunction/ – core library defining Phone class and actions
- bin/ – Robot test cases, keywords, runner, and output artifacts
- docs/, img/, local_test/ – specifications, sample tests, reference data
- Auxiliary files: `.gitignore`, CHANGE LOG, deployment path hint (`venv/lib/python3.5/...`).

##### README Insights
- config/conf.py holds global constants; usr_data.py holds per‑user settings.
- phoneFunction/ defines Phone instantiation and actions (call, forward, upgrade).
- bin/ contains:
- key_words.robot – granular Robot Framework keywords mapped to Python functions
- run.robot – high‑level test scenarios
- log/, report.html, output.xml – execution artifacts

##### Main Components & Interactions
a. Components:
1. Test Runner (Robot Framework CLI via bin/run.robot)
2. Keyword Layer (key_words.robot)
3. Python Library (phoneFunction package)
4. Configuration Module (config package)
5. Device Under Test (Htek phones over network)
6. Reporting & Logging (bin/log/, report.html, output.xml)

b. Relationships & Data Flow:
- Test Runner invokes Robot test suite → loads config settings (conf.py & usr_data.py)
- Robot test cases call keywords (key_words.robot) → keywords delegate to Python functions in phoneFunction/action.py
- PhoneAction functions instantiate Phone objects (phones.py) with parameters → send SIP/HTTP commands to physical or virtual Htek phones
- Phones respond over network → phoneFunction captures status → returns results to Robot Framework
- Robot Framework collects execution data → writes logs (.log), XML, HTML reports

c. Architectural Patterns & Principles:
- Layered separation: Test definitions (Robot) → Keyword abstraction → Core library → External system
- Single Responsibility: config/ exclusively for parameters, phoneFunction/ for device logic
- Extensibility: new keywords or phone models can be added under phoneFunction/syn_phonelib

d. Key Technologies & Libraries:
- Robot Framework (DSL for test cases)
- Python 3.5+ for phoneFunction and config
- syn_phonelib for device-specific configs
- XML (local_test sample input)
- Reporting via Robot’s built‑in HTML/XML output

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Configuration Module
    subgraph "Configuration Module"
        direction TB
        Conf["conf.py"]:::code
        UsrData["usr_data.py"]:::code
    end

    %% Local Test & Sample Data
    subgraph "Local Test & Sample Data"
        direction TB
        SampleXML["cfg10_3_3_18.xml"]:::data
        TestScript["test1.py"]:::code
        ImgDir["img/"]:::data
    end

    %% Documentation & Specifications
    subgraph "Documentation & Specifications"
        direction TB
        Interfaces["Interfaces.md"]:::data
        LCDRecords["LCD_records.txt"]:::data
    end

    %% Main Execution Flow
    subgraph "Test Execution"
        direction TB
        Runner["Robot Runner<br/>(run.robot)"]:::robot
        Keywords["Keyword Definitions<br/>(key_words.robot)"]:::robot
        subgraph "Core Python Library"
            direction TB
            Action["action.py"]:::code
            Phones["phones.py"]:::code
            Upgrade["upgrade.py"]:::code
            subgraph "Device‑Specific Library<br/>(syn_phonelib)"
                direction TB
                HTCConf["htek_phone_conf.py"]:::code
                HTCModel["htek_phones.py"]:::code
            end
        end
        Device["Htek Phones"]:::device
        subgraph "Reporting & Logs"
            direction TB
            LogsDir["bin/log/"]:::data
            HTMLReport["report.html"]:::reports
            XMLReport["output.xml"]:::reports
        end
    end

    %% Connections
    Conf --> Runner
    UsrData --> Runner
    SampleXML -.-> Runner
    Runner --> Keywords
    Keywords --> Action
    Keywords --> Phones
    Keywords --> Upgrade
    Action --> HTCConf
    Action --> HTCModel
    Phones --> Device
    Upgrade --> Device
    Device --> Action
    Action --> Runner
    Runner --> LogsDir
    Runner --> HTMLReport
    Runner --> XMLReport

    %% Click Events
    click Runner "https://github.com/tmahm/htektesttools/blob/master/bin/run.robot"
    click Keywords "https://github.com/tmahm/htektesttools/blob/master/bin/key_words.robot"
    click Action "https://github.com/tmahm/htektesttools/blob/master/phoneFunction/action.py"
    click Phones "https://github.com/tmahm/htektesttools/blob/master/phoneFunction/phones.py"
    click Upgrade "https://github.com/tmahm/htektesttools/blob/master/phoneFunction/upgrade.py"
    click HTCConf "https://github.com/tmahm/htektesttools/blob/master/phoneFunction/syn_phonelib/htek_phone_conf.py"
    click HTCModel "https://github.com/tmahm/htektesttools/blob/master/phoneFunction/syn_phonelib/htek_phones.py"
    click Conf "https://github.com/tmahm/htektesttools/blob/master/config/conf.py"
    click UsrData "https://github.com/tmahm/htektesttools/blob/master/config/usr_data.py"
    click SampleXML "https://github.com/tmahm/htektesttools/blob/master/local_test/cfg10_3_3_18.xml"
    click TestScript "https://github.com/tmahm/htektesttools/blob/master/local_test/test1.py"
    click ImgDir "https://github.com/tmahm/htektesttools/tree/master/local_test/img/"
    click LogsDir "https://github.com/tmahm/htektesttools/tree/master/bin/log/"
    click HTMLReport "https://github.com/tmahm/htektesttools/blob/master/report.html"
    click XMLReport "https://github.com/tmahm/htektesttools/blob/master/output.xml"
    click Interfaces "https://github.com/tmahm/htektesttools/blob/master/docs/Interfaces.md"
    click LCDRecords "https://github.com/tmahm/htektesttools/blob/master/docs/LCD_records.txt"

    %% Styles
    classDef code fill:#D6E9FE,stroke:#3399FF,color:#000;
    classDef robot fill:#E8F5E9,stroke:#34A853,color:#000;
    classDef device fill:#FFE5CC,stroke:#FB8C00,color:#000;
    classDef data fill:#F0F0F0,stroke:#999999,color:#000;
    classDef reports fill:#E0F7FA,stroke:#00838F,color:#000;
```
