Friday 11:50 a.m.–12:30 p.m.

More testing with fewer tests

Clinton Roy

Audience level:
Intermediate

Description

We all wish we were were testing more, but tests are ugly, a pain to write and are brittle. Property based testing helps to solve all of these problems. Now, with Hypothesis, Python has an outstanding toolkit to write property based tests.

Abstract

With Hypothesis, instead of writing individual tests, you describe properties of your code and Hypothesis generates the test cases for you. This frees you from writing repetitive and error prone test cases. Hypothesis will generate many more test cases than you'll ever be able to bare writing, and will find more bugs.

Hypothesis has plugins for Django and numpy to help you generate test cases for these two frameworks.

0 - 5: what's wrong with tests 5 - 10: properties of common code 10 - 15: using these properties with hypothesis, showing the generated test cases 15 - 20: showing off features of hypoethsis through examples 20 - 25: django and numpy plugins 25 - 30: questions