PyCon UK 2022

I hate writing tests, that's why I use Hypothesis
2022-09-16 , Assembly Room

Ok, I lied, I still write tests. But instead of the example-based tests that we normally write, have you heard of property-based testing? By using Hypothesis, instead of thinking about what data I should test it for, it will generate test data, including boundary cases, for you.


In this talk, we will explore what is property-based testing and why it can do a lot of heavy lifting in writing tests for us. As a contributor, I will introduce Hypothesis, a Python library that can help perform property-based tests with ease.

At the start of the talk, we will understand the power of property-based tests, what is it, how is it different from what we “normally do” - testing by example, and why is it useful in testing our code. This will be followed by demonstrations using Hypothesis. With a few examples, we will have a glimpse of how to create strategies - recipes for describing the test data you want to generate.

After that, we will also explore the Ghostwriters in Hypothesis which will actually write the test for you.

This talk is for Pythonistas who are new to property-based testing and found thinking of what parameters to use for testing a difficult task. This talk may provide them with a new approach to writing tests, which will be more efficient for some cases.


Is your proposal suitable for beginners? – yes

Before working in Developer Relations, Cheuk has been a Data Scientist in various companies which demands high numerical and programmatical skills, especially in Python. To follow her passion for the tech community, now Cheuk is the Developer Advocate for Anaconda.

Besides her work, Cheuk enjoys speaking at various conferences. Cheuk also organises events for developers. Cheuk has organised conferences including EuroPython (of which she is a board member), PyData Global and Pyjamas Conf. Believing in Tech Diversity and Inclusion, Cheuk constantly organizes workshops and mentored sprints for minority groups. In 2021, Cheuk has become a Python Software Foundation fellow.