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




Sponsors



Talk Python Training

GoCD