Testing an Interactive Voice Response System With Python and Pytest
Following my previous article on how to build an Interactive Voice Response (IVR) system with Twilio, Python and Django, in this follow-up tutorial I show how to write automated tests for this system.
It can be very challenging to test a system that rely heavily on a third party service such as Twilio. In this article, I show how to organize your code in a way that would isolate your bushiness logic and make it easier to test separately. The article demonstrate useful testing patterns using Django’s
unittest.mock, Pytest fixtures, build-in
django-pytest and many more.
The source code for this article and the previous one can be found here.
Originally published at https://hakibenita.com on May 1, 2020.