Bulletproof Python - Property-Based Testing with Hypothesis

Traditional tests are example-based. They require the developer to come up with arbitrary inputs and check a system’s behaviour against explicit outputs. More often than not, developers only think of inputs that are handled correctly by their code, thus leaving bugs hidden. Property-based tests generate the inputs for you and in many cases they’re more likely to find invalid inputs than humans. The difficulty lies in formulating these test cases.

After this workshop you’ll be comfortable with property-based testing using Hypothesis. You’ll have experience requesting appropriate test data from Hypothesis and in writing tests for common and more advanced properties. At work, your co-workers will be impressed by your unbreakable code ;)

Participants are expected to have basic familiarity with unit testing and a testing framework. Provided code examples use pytest.

Please set up the workshop material in advance. To do that, navigate to the Git repository linked in the supporting material section and follow the setup instructions in the README file.

This session took place in track Testing and was classified suitable for intermediate domain / intermediate python by the speaker.

Michael Seifert

Michael is a trainer and consulting software engineer who helps product teams develop Python software in the cloud. He enjoys deleting code more than writing it and is constantly looking for ways to make software easier to maintain.

Michael published his first FOSS project in 2006. He's the currently a maintainer of pytest-asyncio and happens to be a Shuffle Dance enthusiast.

Social card for talk: Bulletproof Python - Property-Based Testing with Hypothesis