Slide 1

Slide 1 text

Improving design and code quality with Property-based testing

Slide 2

Slide 2 text

Software Consultant - EventStormer Domain Driven Design Behaviour Driven Development Test Driven Development Continuous Delivery @kenny_baas baasie.com @joaoasrosa joaorosa.io

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

The greatest obstacle to discovery is not ignorance - it is the illusion of knowledge. - Daniel J. Boorstin

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Confirmation Bias

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

blue yellow yellow red green purple blue blue green purple yellow red green yellow purple blue red yellow green red blue purple yellow purple red blue purple blue green yellow red red purple green yellow blue blue yellow green red purple yellow blue green red purple yellow red blue green purple green red yellow purple blue purple green red blue yellow yellow red green purple blue blue green purple yellow red green yellow purple blue red yellow green red blue purple yellow purple red blue green red purple yellow blue green red purple yellow red blue green purple green red yellow purple blue purple green red blue yellow yellow red green purple blue blue green purple yellow red green yellow purple blue red yellow green red blue purple yellow purple red blue green red purple yellow blue green red purple yellow red blue green purple green red yellow purple blue purple green red blue yellow yellow

Slide 18

Slide 18 text

To communicate effectively, the code must be based on the same language used to write the requirements - the same language that the developers speak with each other and with domain experts - Eric Evans

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Dave Farley - Continuous Delivery Feedback Quickly Timely Reliable Customer

Slide 21

Slide 21 text

Releasing software is too often an art; it should be an engineering discipline - Dave Farley

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Single abstraction examples (aka Unit tests) ● Learning from mistakes instead of only confirming ● Fast feedback on new demands instead of slow changes ● Living documentation on behaviour instead of on data

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Human CI ● Always run tests locally before commiting ● Once the code is committed, wait for the result of commited build ○ Don’t go home, to lunch, to a meeting, to make coffee ● If a teammate has gone home, lunch…. revert their changes! ● Fix or revert within 10 minutes ● When there are failures, Pair or Mob and learn together Dave Farley - Continuous Delivery

Slide 29

Slide 29 text

Software Development is a learning process, working code is a side effect - Alberto Brandolini

Slide 30

Slide 30 text

Benefits ● Covers (eventually) the scope of all data points, forget about data ● Shrinker looks for a small use case ● Reproducible tests Next thing -> Fuzzing invalid inputs in System Tests

Slide 31

Slide 31 text

Summary ● (Also) Write tests with the intention of breaking code ● Forget about data, focus on behaviour! ● Quickly, Timely, Reliable Feedback ● Human CI ● Ohh… Have we mentioned Domain Driven Design?

Slide 32

Slide 32 text

C# https://github.com/joaoasrosa/techorama-nl-property-based-testing Java https://gitlab.com/Baasie/Property-Based-Testing

Slide 33

Slide 33 text

#CatTax