derberg / python-mqtt-client-template

This template generates MQTT Python client module. Its purpose is to abstract for the application client technical information about the broker and the names of topics it should use. Instead, it generates a module that provides a set of indent-driven functions that one can invoke to send a message to the application through the message broker.
2 stars 1 forks source link

Start doing snapshot testing #1

Open derberg opened 1 year ago

derberg commented 1 year ago

We need to test the output of generation.

So we have a sample AsyncAPI file, and we also generate client.py file basing on it. We should have a test that rungs generation, persists generated file. Thanks to it, whenever we make changes to code, that we do not want have affect on generated file, this tests will help us to automatically confirm all is good or fail.

It is a concept widely adopted in frontend development: https://www.sitepen.com/blog/snapshot-testing-benefits-and-drawbacks#:~:text=Snapshot%20testing%20is%20a%20type,from%20unit%20and%20functional%20tests.

Example on how it was introduced in nodejs template: https://github.com/asyncapi/nodejs-ws-template/pull/149

thulieblack commented 2 weeks ago

https://fathom.video/share/nsawKh_BKw19_7ABgMCLpYgUZBqKyVFR?tab=summary