How randomsync/robotframework-mqttlibrary works
Project type and purpose
• This is a Robot Framework “test library” package written in Python.
• Its purpose is to expose MQTT operations (connect, publish, subscribe, etc.) as Robot Framework keywords, using the Eclipse Paho MQTT client under the hood.
• It integrates with external MQTT brokers (Eclipse Mosquitto) to validate messaging behavior in IoT scenarios.
File structure
• Top‑level artifacts:
– setup.py, requirements.txt → Python packaging & dependencies
– src/MQTTLibrary/ → library source code
– tests/ → Robot Framework test cases exercising your keywords
– mosquitto/ → sample broker configuration (no‑auth and auth setups)
– .travis.yml → CI pipeline on Travis CI
• Patterns:
– Library code implements a plugin for Robot (Robot loads the package via setup.py).
– Tests spin up Dockerized Mosquitto brokers with/without authentication, then drive the library.
Extract insights from the README
• The library uses Paho MQTT client to talk to brokers.
• Local tests require two broker instances (plain & auth); configuration provided under mosquitto/.
• CI automatically runs tests on Travis by starting brokers in Docker and invoking robot -P src tests.
Components and interactions (to represent
a. Main components:
1. Robot Framework Test Runner
2. MQTTLibrary (your Python package)
3. Paho MQTT Client (Python API)
4. MQTT Broker #1 (no‑auth)
5. MQTT Broker #2 (username/password auth, config under mosquitto/)
6. Docker Host (runs broker containers)
7. CI/CD System (Travis CI)
8. Documentation site (Gh‑Pages)
b. Relationships / Data flows:
• Robot Runner → loads MQTTLibrary API → Robot issues “Connect/Publish/Subscribe” keywords →
• MQTTLibrary → invokes Paho client calls → establishes TCP connection → exchanges MQTT packets →
• Brokers receive or push messages on topics → MQTTLibrary forwards status/results → Robot asserts outcomes.
• CI/CD spins up Docker Host and brokers before running the above flow.
c. Architectural patterns & principles:
• Plugin‑style library for Robot Framework (thin wrapper over Paho).
• Client‑server (MQTT pub/sub) communication.
• Separation of concerns: test runner vs. library vs. broker infrastructure.
d. Key technologies:
• Python (packaging via setup.py, version.py)
• Robot Framework (tests and keyword library interface)
• Eclipse Paho MQTT (client library)
• Eclipse Mosquitto (broker images in Docker)
• Docker (broker orchestration)
• Travis CI (.travis.yml)