I need to test MQTT behaviors and events emitted by MQTT. E.g whenever I(mock device) publish to MQTT, the Handler gets called by it with valid params(tested this with iex but needs to automate the process) and I performs some actions on the data.
Steps:
- installed mqqt via docker container
- added tortoise dependency to my elixir project
- and added basic listner
- and tried in console and listen successfully
Tortoise.publish(:client_id, "d", "my msg" , qos: 0).
Note: I tried to use mock
and mox
libraries for listening but unable to capture the call event
Question/issue: MQTT listens to events(some device publish events to MQTT server) and MQTT calls an elixir listener associated with it. I need to test this behavior: Lets say listener get called by MQTT within 10 seconds. How do I check inside test cases that this method/listener has been called within 10 seconds(with correct params) after I initiate a publish to MQTT
Library: https://github.com/gausby/tortoise