Hypothesis
Randomised testing for
Django
Rae Knowler, DjangoCon Europe 2015
Introduction
Rae Knowler
CKAN, Symfony, Django
@RaeKnowler
they/their/them
David MacIver and Sinister Katze
@DRMacIver @sinister_katze
Hypothesis
Property based testing library
Inspired by Haskell’s Quickcheck
http://hypothesis.readthedocs.org
Hypothesis
Why is it so great?
Why is it so great?
● Lots of randomised data
Why is it so great?
● Lots of randomised data
● Simplifies examples
Why is it so great?
● Lots of randomised data
● Simplifies examples
● Remembers interesting inputs
Why is it so great?
● Lots of randomised data
● Simplifies examples
● Remembers interesting inputs
● Can deal with complex data types
Why is it so great?
● Lots of randomised data
● Simplifies examples
● Remembers interesting inputs
● Can deal with complex data types
● Works with pytest and unittest
Hypothesis +
Django
hypothesis-django
hypothesis-django
● Custom field types
hypothesis-django
● Custom field types
● Generate child models
hypothesis-django
● Custom field types
● Generate child models
● Fixtures (new!)
Getting started
Install
pip install hypothesis
pip install hypothesis-django
Demo
Summary
Links
hypothesis.readthedocs.org
github.com/bellisk/hypothesis-django-example
@RaeKnowler
raeknowler.com
Thank you!

Hypothesis randomised testing for django