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 RequestFactory, 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.

Read “Testing a Twilio Interactive Voice Response System With Python and Pytest” on the Twilio blog ≫

Image for post
Image for post
Testing a Twilio Interactive Voice Response (IVR) System With Python and pytest

Originally published at https://hakibenita.com on May 1, 2020.

Written by

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store