How to create unit test for a Python Telegram Bot

Viewed 2591

I've built this Telegram Bot in Python, with python-telegram-bot. It's not so complex, but I want to do some regression tests to check if everything works fine after a new feature or a change, and more generally to test specific features to find bugs/edge cases.

How can I achieve this?
For now, I'm doing this manually, clicking bot's keyboard and typing some text.

1 Answers

Have you looked to unit tests that are present in python-telegram-bot library? I think it is a good place to start.

For example, in this file you can see how to test a dialog with bot that uses ConversationHandler.

Related