XaverStiensmeier / ilarisdiscordbot

A discord bot for the ilaris ttrpg
GNU General Public License v3.0
0 stars 0 forks source link

Testing the bot #62

Closed lukruh closed 6 months ago

lukruh commented 6 months ago

I found this library: https://dpytest.readthedocs.io/en/latest/tutorials/getting_started.html maybe its worth a try. I'm thinking of a set of example commands that are send to the bot automatically and just check if it gets an answer or raises an error.

lukruh commented 6 months ago

It integrates into discrod.py and pytest. I added a file with some example tests. With the given examples it should be pretty straightforward to create more similar tests at least for trivial message->reply commands. Passing the tests does not necessarily mean everything is fine. But we can ensure that a range of bot commands do not directly cause errors, without testing every command manually after every commit.

lukruh commented 6 months ago

I don't really want to add a test for every single command right now. But we can just add a test whenever we fix a bug, to make sure similar bugs get found automatically next time. I added dpytest to the requirements, it's not that heavy, but if we have more "optional" or "dev-related" dependencies, we could think about adding a requirements-dev.txt at some point.