Hypothesis randomised testing for django

Post on 13-Apr-2017

260 views 3 download

Transcript of Hypothesis randomised testing for django

HypothesisRandomised testing for DjangoRae Knowler, DjangoCon Europe 2015

Introduction

Rae Knowler

CKAN, Symfony, Django@RaeKnowlerthey/their/them

Hypothesis

Property based testing libraryInspired 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

Thank you!