Chapter 16Advanced Parametrization

We’re going to wrap up this book by swinging back to parametrization and look at some advanced techniques. In Chapter 5, Parametrization, we looked at parametrizing tests and fixtures, and you learned how to implement parametrized testing with the hook function, pytest_generate_tests(). However, we left the chapter with some pretty simple parametrizations of a test using one parameter with string values. We’re going to do so much more in this chapter.

In this chapter we’ll look at:

  • Using data structures or objects as values. That complicates the test case identifier slightly, but we’ll use custom identifiers to make the test node IDs readable.

  • Using dynamic values. We’ll use a function to dynamically generate ...

Get Python Testing with pytest 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.