Hypothesis
Randomised testing for
Django
Rae Knowler, DjangoCon Europe 2015
Slide 2
Slide 2 text
Introduction
Slide 3
Slide 3 text
Rae Knowler
CKAN, Symfony, Django
@RaeKnowler
they/their/them
Slide 4
Slide 4 text
David MacIver and Sinister Katze
@DRMacIver @sinister_katze
Slide 5
Slide 5 text
Hypothesis
Property based testing library
Inspired by Haskell’s Quickcheck
http://hypothesis.readthedocs.org
Slide 6
Slide 6 text
Hypothesis
Slide 7
Slide 7 text
Why is it so great?
Slide 8
Slide 8 text
Why is it so great?
● Lots of randomised data
Slide 9
Slide 9 text
Why is it so great?
● Lots of randomised data
● Simplifies examples
Slide 10
Slide 10 text
Why is it so great?
● Lots of randomised data
● Simplifies examples
● Remembers interesting inputs
Slide 11
Slide 11 text
Why is it so great?
● Lots of randomised data
● Simplifies examples
● Remembers interesting inputs
● Can deal with complex data types
Slide 12
Slide 12 text
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
Slide 13
Slide 13 text
Hypothesis +
Django
Slide 14
Slide 14 text
hypothesis-django
Slide 15
Slide 15 text
hypothesis-django
● Custom field types
Slide 16
Slide 16 text
hypothesis-django
● Custom field types
● Generate child models