10
Creating Test Cases for Flask
After building the components of Flask, it is essential to create test cases to ensure their correctness and to fix their bugs. Among the types of testing, unit testing focuses on testing the effectiveness and performance of components independent of other modules or tasks. On the other hand, integration testing ensures the correctness of a Flask component’s functionality and reliability with all its dependencies together at runtime.
To implement these test cases, Python has a built-in module called unittest that can provide a TestCase superclass and the setUp() and tearDown() methods that build variations of test cases and test suites. There is also a third-party module called pytest, which is simple, easy to ...
Get Mastering Flask Web and API Development 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.