Django testing Using pytest and Hypothesis for test generation What - - PowerPoint PPT Presentation

django testing
SMART_READER_LITE
LIVE PREVIEW

Django testing Using pytest and Hypothesis for test generation What - - PowerPoint PPT Presentation

Django testing Using pytest and Hypothesis for test generation What we will cover during this presentation Pytest Pytest-django plugin Using pytest parametrization to generate tests Adding hypothesis into the mix What to


slide-1
SLIDE 1

Django testing

Using pytest and Hypothesis for test generation

slide-2
SLIDE 2

What we will cover during this presentation

  • Pytest
  • Pytest-django plugin
  • Using pytest parametrization to generate tests
  • Adding hypothesis into the mix
slide-3
SLIDE 3

What to expect

Beginners welcome!

  • Since we are focusing on pytest and hypothesis, you can use this techniques for
  • ther frameworks or testing in general
  • We won’t be going too much in depth, but hopefully you will have enough

knowledge to start using it in your projects

slide-4
SLIDE 4

What will we do

  • Make a website for keeping track of unicorns
  • Add new unicorn and list added unicorns
slide-5
SLIDE 5

Before testing

  • Know what are you building
  • Play around with low fidelity prototypes aka get paper and start drawing
  • Write an API specification
  • Sleep
  • Rewrite API specification
slide-6
SLIDE 6

Our first end-point

slide-7
SLIDE 7

Our Unicorn model

slide-8
SLIDE 8

Couple of test to make sure unicorns are ok

slide-9
SLIDE 9

Our simple view up to this point

slide-10
SLIDE 10

Sending invalid requests structure

Two tests for the price of one

slide-11
SLIDE 11

Sending invalid request data types

slide-12
SLIDE 12

Enter the Hypothesis

  • Rewriting above tests using hypothesis
  • Benefits of testing all sorts of crazy inputs (unicode chaos)
slide-13
SLIDE 13

Type to test valid text inputs with hypothesis

Hundred tests with one simple fixture

slide-14
SLIDE 14

Contact information

Connect with me on linkedin and let's chat about python https://www.linkedin.com/in/boyan-miletic/ Email: bojan@softerrific.com

slide-15
SLIDE 15

Questions?