Coder Social home page Coder Social logo

mtrx / robotframework-mqttlibrary Goto Github PK

View Code? Open in Web Editor NEW

This project forked from randomsync/robotframework-mqttlibrary

0.0 0.0 0.0 252 KB

MQTT Keyword Library for Robot Framework

License: Apache License 2.0

Python 45.98% RobotFramework 54.02%

robotframework-mqttlibrary's Introduction

MQTTLibrary for Robot Framework

https://travis-ci.org/randomsync/robotframework-mqttlibrary.svg?branch=master

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.

robotframework-mqttlibrary's People

Contributors

randomsync avatar janvanoverwalle avatar vogoltsov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.