Introduction
Beyond the basic tasks of running tests and generating reports, pytest offers many advanced features. These features can improve and simplify your testing and help you to craft more robust tests, expand test coverage, and troubleshoot failures.
In this module, you'll learn about features of the pytest framework that will help you write effective tests that are also simple and readable.
What you will learn
After completing this module, you'll be able to use parametrize in your tests to reduce code repetition and improve test coverage. You'll also learn about fixtures, which enable sharing common setups and cleanups in tests.
Completing this module helps you to:
- Increase code coverage by adding input values using parametrize
- Build common test code with custom fixtures and avoid code repetition
- Use the monkey patch fixture to safely invoke code by calling mock functions and setting mock values
What is the main goal
You should feel confident in your ability to begin using these advanced features of pytest. These features can help you to write more robust and powerful tests with improved coverage.