Brought to you by H I R E D - The easiest way to get a job as a developer. Find your dream job today.

Episode #67: Property-based Testing with Hypothesis

Published Wed, Jul 13, 2016, recorded Mon, Jul 11, 2016.

Let's talk about your unit testing strategy. How do you select the tests you write or do you even write tests? Typically, when you write a test you have to think of what you are testing and the exact set of inputs and outcomes you're looking for. And there are strategies for this. Try to hit the boundary conditions, the most common use-cases, seek out error handling and so on.

We all do this to varying degrees of success. But we if we didn't have to do this. What if there was some kind of way to express the relationship between inputs and outputs but your tests could explore the problem space themselves?

Well, there is a way and it's called property-based testing. This week you'll learn about Hypothesis, the most popular property based testing system created by David MacIver.

Links from the show:

Hypothesis framework: hypothesis.works
Hypothesis on github: github.com/HypothesisWorks/hypothesis-python
Matt Bachmann - Better Testing With Less Code at PyCon:
youtube.com/watch?v=jvwfDdgg93E
David on the web: drmaciver.com

Want to go deeper? Check out my courses


David MacIver
David is the primary author of Hypothesis, a property-based testing system for Python.

He consults on software quality and testing, and offer a variety of training courses and workshops, especially centred around the use of Hypothesis.

He's also into various other things. By training he's a mathematician, but my work these days is as a software developer. He have a tendency to rant entertainingly, a fondness for quality and an annoying tendency to tell you why you’re doing it wrong and you should do it my way instead.


Individuals: Support this podcast via Patreon or one-time via Square Cash or . Corporate sponsorship opportunities available here.