MQTT Keyword Library Robot Framework
Project description
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 are run automatically through travis when code is pushed to a branch. Most of the tests rely on the public mqtt broker at iot.eclipse.org, but some that validate authentication rely on a local broker. You can start a local broker with the provided configuration. You can then run the tests locally:
docker pull eclipse-mosquitto docker run -d -p 1883:1883 -p 9001:9001 -v $(pwd)/mosquitto:/mosquitto/config eclipse-mosquitto pybot -P src tests
Make sure to stop the docker container when it is no longer needed.
License
MQTTLibrary is open source software provided under the Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotframework-mqttlibrary-0.6.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | be9a5c306d449dace3fc4b268848fff1a540d27cfba498ec5a722ed7ac9dc562 |
|
MD5 | 6973058a5538e06ef1ce3072e55fb84e |
|
BLAKE2b-256 | 37d8256b430f8e6b41610d5c73885c5eb584c654d8cc454c56edf6a75934d2ff |
Hashes for robotframework_mqttlibrary-0.6.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ca4c8cb8b4b6864fa4b629710a07b44546528b0966c2e6cfefff1d4c2608df |
|
MD5 | 8ff2669c5cea0702e5d59a77211d9fc8 |
|
BLAKE2b-256 | 0ff9655cea3791e87503b12f1c35e9fc91c27cbd687f0c95d4c77dff7dec15f6 |