Better parameterized pytests with dataclasses
September 14, 2023 / 23 min read / 2,849 , 5 , 0
Last Updated: May 12, 2024
Parameterization is a powerful tool in pytest (the most popular Python testing framework). It allows us to write a single, simple test that can dynamically expand to become many similar tests with minor input differences. In this blog post, I will describe how to write parameterized pytests and why they are such a powerful tool. And then, I’ll show you how to re-write parameterized tests more effectively using dataclasses.