Writing tests that write themselves on Nov. 18, 2017 at 11:10 a.m. in Tutorial (R-M150)

Sign up for David Kua tutorial.

Property-based testing is a powerful method of generating test cases from properties of your code. With a few lines of code you can have tests that create and test hundreds of examples and can catch edge cases in your code that you weren't even aware of. Originally only available for Haskell developers via the QuickCheck library, property-based tests can now be written in a variety of languages including Python. In this tutorial you will learn about the basics of property-based testing and how to get started writing property-based tests using the Python library Hypothesis. You will also learn how to add and use property-based tests alongside other tests in your existing codebases.

To follow along, attendees will need working knowledge of Python and a laptop with Python 2.7+, pytest, and Hypothesis.


Speaker

David Kua

David started programming with Python in 2011 while studying computer science at the University of Toronto. Since then he has taught and talked about Python at university, PyCon Canada, and PyOhio. He is currently a Site Reliability Engineer at PagerDuty and is also one of the organizers of the Toronto chapter of Papers We Love.