The Python standard library ships with a testing framework named unittest, which you can use to write automated tests for your code. The unittest package has an object-oriented approach where test cases derive from a base class, which has several useful methods.
The framework supports many features that will help you write consistent unit tests for your code. These features include test cases, fixtures, test suites, and test discovery capabilities.
In this video course, you’ll learn how to:
- Write
unittesttests with theTestCaseclass - Explore the assert methods that
TestCaseprovides - Use
unittestfrom the command line - Group test cases using the
TestSuiteclass - Create fixtures to handle setup and teardown logic
To get the most out of this video course, you should be familiar with some important Python concepts, such as object-oriented programming, inheritance, and assertions. Having a good understanding of code testing is a plus.
