Chapter 12. Testing Flask Apps

Throughout this book, every time that we have made a modification to our application's code, we have had to manually load the affected web pages into our browser to test if the code was working correctly. As the application grows, this process becomes more and more tedious, especially if you change something that is of low level and used everywhere, such as SQLAlchemy model code.

In order to automate the process of verifying that our code works the way we want it to, we will use a built-in feature of Python that allows us to write tests, normally named unit tests, which are checked against our application's code.

What are unit tests?

Testing a program is very simple. All it involves is running particular pieces of your ...

Get Mastering Flask now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.