EuroPython 2016

Property-based testing with Hypothesis

Speaker(s) David MacIver

Hypothesis is a library for writing smarter tests.

Instead of hand-writing every example in your tests, you describe what sorts of examples you need and let it fill in the blanks. It uses this to actively go looking for bugs in your code.

It’s proven very effective, and is being used by an ever growing number of open source projects (including pypy, cryptography, and mercurial), but people sometimes struggle to get started.

In this session we’ll help you overcome that by going through a number of illustrative examples that will help you understand this style of testing better.

The first two hours will be spent on these, start with a discussion of the problem, a sample test to start you off, and then people will work through it at their own pace, with me there to answer questions and help people when they get stuck. After people have had some time on a given problem, I’ll go over some possible tests for the example and why they are useful, and give people time to try anything they like out before moving on to the next problem.

For the final hour, people will work on testing some more substantial code. You should feel free to bring your own, but I will provide some interesting projects for people to work on for anyone who doesn’t have anything specific.

At the end of this you should feel much more comfortable with the general concepts of property based testing, and be able to use Hypothesis effectively to test your own code.

in on Monday 18 July at 10:15 See schedule

Do you have some questions on this talk?

New comment