PyCon UK 2022

Property-Based Testing the Python Way
2022-09-17 , Assembly Room

What if I told you that you could write simpler tests but get better results?

What if I told you can automatically generate your test data?

This may sound difficult to your traditional testing approach but can be easily done with Hypothesis, the Python library used for property-based testing.


This is an introductory talk about property-based testing. The talk requires some previous knowledge about testing to make the most out of it but if you are new and curious I think you would get something out of it.

The talk approaches a simple problem from two different testing perspectives. Giving you an idea about property-based testing and how it’s different from the traditional approach with Python.

The main focus of the topic would be Hypothesis and how you can achieve your testing goals with it.

By the end of this talk you would have a solid understanding of property-based testing with Hypothesis, that would help you decide which testing approach fits your need.

Given below is a rough overview of the talk structure:
The testing problem.
The traditional approach.
Cons of traditional approach.
What property-based testing.
Intro to Hypothesis.
Same problem solution with Hypothesis.
Why choose Hypothesis as a go-to property based testing tool.
Parameterized testing with Pytest vs Hypothesis approach.
When or when not to use property based testing.
How you can adopt hypothesis in your code base.


Is your proposal suitable for beginners?: yes

Emma is a developer advocate. She enjoys sharing her knowledge and learning from fellow developers.