Description
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.