Review
In this chapter, we looked at three ways to parametrize tests:
-
We can parametrize test functions, creating many test cases, when we apply the @pytest.mark.parametrize() decorator.
-
We can parametrize fixtures with @pytest.fixture(params=()). This is helpful if the fixture needs to do different work based on the parameter values.
-
We can generate complex parametrization sets with pytest_generate_tests.
We also looked at how we can run subsets of parametrized test cases using pytest -k.
However, while the techniques for parametrization covered in this chapter are quite powerful, when you start using parametrization in your own testing, you may run into more complex parameter set needs, such as needing to
-
parametrize multiple parameters with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access