Skip to main content

MQTT Keyword Library Robot Framework

Project description

https://travis-ci.org/randomsync/robotframework-mqttlibrary.svg?branch=master 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 are run automatically through travis when code is pushed to a branch. When run locally, these tests rely on locally running mqtt brokers. We need 2 running brokers, one without auth that is used by most of the tests, and the other one with auth (configuration file is provided). You’ll need to start them before running the tests. You can then run the tests locally:

docker pull eclipse-mosquitto
docker run -d -p 1883:1883 eclipse-mosquitto
docker run -d -p 11883:1883 -p 9001:9001 -v $(pwd)/mosquitto:/mosquitto/config eclipse-mosquitto
robot -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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework-mqttlibrary-0.7.1.post3.tar.gz (10.8 kB view details)

Uploaded Source

Built Distributions

File details

Details for the file robotframework-mqttlibrary-0.7.1.post3.tar.gz.

File metadata

  • Download URL: robotframework-mqttlibrary-0.7.1.post3.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.15

File hashes

Hashes for robotframework-mqttlibrary-0.7.1.post3.tar.gz
Algorithm Hash digest
SHA256 11ae581c9ae2f21faac9f9bad4bd6f9251f86ca340a0d85e3bff75b87047a2ba
MD5 da707e5e05d27e4d1561631134d2f04b
BLAKE2b-256 214795755017935d6483481a6708073579a876f3f0fa9301d2c1674ca16f8c2a

See more details on using hashes here.

File details

Details for the file robotframework_mqttlibrary-0.7.1.post3-py3-none-any.whl.

File metadata

  • Download URL: robotframework_mqttlibrary-0.7.1.post3-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.1

File hashes

Hashes for robotframework_mqttlibrary-0.7.1.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 990bb0d130e426172d34cd2590b229099c966c2fcdae560220319b33da3eba47
MD5 ec1fb0d254ead7485ba2f8d3ebe7e99e
BLAKE2b-256 c1eba193e5646399173d8b964e9b40dc53ef36bd096d68ba886a3cea0c558f0b

See more details on using hashes here.

File details

Details for the file robotframework_mqttlibrary-0.7.1.post3-py2-none-any.whl.

File metadata

  • Download URL: robotframework_mqttlibrary-0.7.1.post3-py2-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/2.7.15

File hashes

Hashes for robotframework_mqttlibrary-0.7.1.post3-py2-none-any.whl
Algorithm Hash digest
SHA256 4a7d8990d330e66a4f89cfffced8d1da348565e4b8a4fa8e2eb4554d07e7ccde
MD5 5a7911132493a49e6d839684c93deaa7
BLAKE2b-256 2f98204bfd7681141e1f667d79f0e8e1f2c0196e181c4a323dc51c21fb39e68b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page