Monitor performance issues & errors in your code

Property-based Testing with Hypothesis

Episode #67, 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 on github:
Matt Bachmann - Better Testing With Less Code at PyCon:
David on the web:

Want to go deeper? Check out our courses

David MacIver
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.
Episode sponsored by
Ads served ethically
Talk Python's Mastodon Michael Kennedy's Mastodon