Adafruit_CircuitPython_MiniMQTT
Adafruit_CircuitPython_MiniMQTT copied to clipboard
Add test suite
Similar to work done within requests (https://github.com/adafruit/Adafruit_CircuitPython_Requests/tree/master/tests), this library should have a test suite which tests the MQTT protocol
Here's one idea for testing: it might be worthwhile to use a good MQTT server implementation (such as Mosquitto). For a functional PUBLISH test it might look like this:
- start the server
- distinct client implementation (such as Paho or Mosquitto) subscribes to a topic
- MiniMQTT publishes a message to the topic
- the client from step 2 and/or the server will verify that the message arrived
Another idea which I started to implement in PR #187 is to fake the state and produce/capture socket data and verify it against the data sent by known good MQTT client implementation. This is based on the "Mocket" idea from adafruit_requests and a set of private tests I've written recently for custom almost-MQTT server implementation (these tests are used for evaluation of a final assignment for Unix system programming class at Charles university in Prague to complement public set of tests). This will provide protocol level testing.