Skip to main content

MQTTLibrary for Robot Framework

CI https://badge.fury.io/py/robotframework-mqttlibrary.svg

MQTTLibrary is a Robot Framework library that provides keywords for testing on MQTT brokers. MQTT is a lightweight protocol for machine-to-machine communication, typically used for IoT messaging. This library uses the paho client library published by eclipse project.

Installation

MQTTLibrary can be installed using pip:

pip install robotframework-mqttlibrary

You can also install it from the source distribution by running:

python setup.py install

You may need to run the above command with administrator privileges.

Usage

Import the library:

*** Settings ***
Library          MQTTLibrary

Connect to the broker, publish and disconnect:

*** Test Cases ***
Publish
    Connect     127.0.0.1
    Publish     topic=test/mqtt_test    message=test message
    [Teardown]  Disconnect

Connect to the broker, subscribe and validate that a message is received:

*** Test Cases ***
Subscribe and Validate
    Connect                 127.0.0.1
    Subscribe and Validate  topic=test/mqtt_test    qos=1   payload=test
    [Teardown]              Disconnect

Keyword documentation is available at: http://randomsync.github.io/robotframework-mqttlibrary.

Also look at tests folder for examples.

For general information about using test libraries with Robot Framework, see Robot Framework User Guide.

Contributing

The keywords in this library are based on some of the methods available in eclipse paho client library. If you’d like to add keywords, see instructions on creating/updating libraries for Robot Framework.

The tests are in tests folder and make use of Robot Framework itself. They need two local MQTT brokers: one without authentication, used by most tests, and one that requires a username and password. Both are defined in docker-compose.yml. They need Docker Engine 25 or later. Start them, run the tests, and stop them when you are done:

docker compose up --wait
robot -P src tests
docker compose down

The test credentials live in mosquitto/passwd_file. To regenerate it, run scripts/gen-passwd.sh.

License

MQTTLibrary is open source software provided under the Apache License 2.0.

Metadata

Release files for robotframework-mqttlibrary 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-mqttlibrary 0.7.2
File Size Uploaded
robotframework_mqttlibrary-0.7.2.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-mqttlibrary 0.7.2
File Interpreter ABI Platform
robotframework_mqttlibrary-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / robotframework_mqttlibrary-0.7.2.tar.gz

Download URL robotframework_mqttlibrary-0.7.2.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d74c07c7895c75b8b2b573f080e73edd5f00da3e9910f2ab829dcaa7b93c0f2e
BLAKE2b-256 checksum
How to use checksums
3348a783bd7f75c495838536c436bc5b42b55c0e9eb0c757a761d21c482982cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / robotframework_mqttlibrary-0.7.2-py3-none-any.whl

Download URL robotframework_mqttlibrary-0.7.2-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fcdeb22f388f603c22c0f407d43f67921bdb12f6229d81b57ca7866dfbb3305
BLAKE2b-256 checksum
How to use checksums
c4761ff6fe0f1372a581299e02e83f2fcdaa2070168c3a7620e105b995926acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.7.2 This release

2 release files

0.7.1

2 release files

0.7.0

3 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page