Skip to main content
EuroPythonCode of ConductBuy tickets

Property-based testing the Python way

Room:
Liffey Hall 2
Start:
14:30 on 13 July 2022
Duration:
30 minutes

Abstract

What if I told you you could write simpler tests but still get better results ?

What if I told you can automatically generate your test data ?

This may sound difficult to your traditional testing approach but can be easily done with property-based testing.

Property-based testing allows a range of inputs to be tested on a given aspect of a software property, abstracting away the details.

In the world of Python you can accomplish this with Hypothesis, the Python library used for property-based testing.

Hypothesis helps you design cleaner and clever test suites.

TalkTesting

Description

This is an introductory talk about property-based testing. The talk requires some previous knowledge about testing to make the most out of it but if you are new and curious I think you would get something out of it.

The talk approaches a simple problem from two different testing perspectives. Giving you an idea about property-based testing and how it’s different from the traditional approach with Python.

The main focus of the topic would be Hypothesis and how you can achieve your testing goals with it.

By the end of this talk you would have a solid understanding of property-based testing with Hypothesis, that would help you decide which testing approach fits your need.

Given below is a rough overview of the talk structure:

  • The testing problem - This is where you would explain the problem statement
  • The traditional approach
  • Cons of traditional approach
  • What is property-based testing ?
  • Intro to Hypothesis
  • Same problem solution with Hypothesis
  • Why choose Hypothesis as a go-to property based testing tool ?
  • Parametrized testing with Pytest vs Hypothesis approach
  • When or when not to use property based testing
  • How can you adopt hypothesis in your code base ? Some opinions here.

The speaker

Emma Saroyan

Emma is a developer advocate at Alpaca. She enjoys sharing her knowledge and learning from fellow developers.



← Back to schedule