Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randomsync/robotframework-mqttlibrary
MQTT Keyword Library for Robot Framework
https://github.com/randomsync/robotframework-mqttlibrary
Last synced: 26 days ago
JSON representation
MQTT Keyword Library for Robot Framework
- Host: GitHub
- URL: https://github.com/randomsync/robotframework-mqttlibrary
- Owner: randomsync
- License: apache-2.0
- Created: 2015-02-18T06:52:41.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T06:32:34.000Z (7 months ago)
- Last Synced: 2024-11-13T11:41:26.429Z (30 days ago)
- Language: RobotFramework
- Size: 246 KB
- Stars: 26
- Watchers: 5
- Forks: 31
- Open Issues: 14
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-robotframework - MQTT Library
README
MQTTLibrary for Robot Framework
===============================.. image:: https://travis-ci.org/randomsync/robotframework-mqttlibrary.svg?branch=master
:target: https://travis-ci.org/randomsync/robotframework-mqttlibrary.. image:: https://badge.fury.io/py/robotframework-mqttlibrary.svg
:target: https://badge.fury.io/py/robotframework-mqttlibraryMQTTLibrary 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.
.. _Robot Framework: http://robotframework.org
.. _MQTT: http://mqtt.org/
.. _paho: https://eclipse.org/paho/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:
.. code-block:: robotframework
*** Settings ***
Library MQTTLibraryConnect to the broker, publish and disconnect:
.. code-block:: robotframework
*** Test Cases ***
Publish
Connect 127.0.0.1
Publish topic=test/mqtt_test message=test message
[Teardown] DisconnectConnect to the broker, subscribe and validate that a message is received:
.. code-block:: robotframework
*** Test Cases ***
Subscribe and Validate
Connect 127.0.0.1
Subscribe and Validate topic=test/mqtt_test qos=1 payload=test
[Teardown] DisconnectKeyword 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`__.__ http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-test-libraries
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 testsMake sure to stop the docker container when it is no longer needed.
.. _instructions: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-libraries
License
-------
MQTTLibrary is open source software provided under the `Apache License 2.0`__.__ http://apache.org/licenses/LICENSE-2.0