Slide 1

Slide 1 text

TESTING building CULTURE

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

THIS IS NOT ABOUT TDD!

Slide 4

Slide 4 text

@ordepdev

Slide 5

Slide 5 text

First of all Why testing?

Slide 6

Slide 6 text

“It’s time for software developers to take up the mantle of responsibility for what they produce.

Slide 7

Slide 7 text

Testing is the engineering rigour of software development.

Slide 8

Slide 8 text

Responsibility — the state or fact of being accountable or to blame for something.

Slide 9

Slide 9 text

Rigour — the quality of being extremely thorough and careful.

Slide 10

Slide 10 text

Software Engineering

Slide 11

Slide 11 text

An engineering discipline that is concerned with all aspects of software production.

Slide 12

Slide 12 text

MUCH MORE THAN CODING!

Slide 13

Slide 13 text

Types of Bad Software Projects

Slide 14

Slide 14 text

1. Without tests.

Slide 15

Slide 15 text

Zero Automated Tests.

Slide 16

Slide 16 text

ZERO!

Slide 17

Slide 17 text

Lack of professionalism?

Slide 18

Slide 18 text

Lack of skills?

Slide 19

Slide 19 text

Lack of knowledge?

Slide 20

Slide 20 text

Lack of time to test?

Slide 21

Slide 21 text

It can be all of them.

Slide 22

Slide 22 text

What about software quality?

Slide 23

Slide 23 text

Relax, they test all features with manual testing.

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

2. With Wrongly Designed Tests..

Slide 26

Slide 26 text

Testing is HARD.

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Testing pitfalls: coupling.

Slide 29

Slide 29 text

Implementation Boundary Testing Boundary

Slide 30

Slide 30 text

Implementation Boundary Testing Boundary ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ❌ ❌

Slide 31

Slide 31 text

Uncertainty and Doubt.

Slide 32

Slide 32 text

Implementation Boundary Testing Boundary ✅ ✅ ✅ ✅ ✅ ❌ ❌ ❌ ❌ ❌

Slide 33

Slide 33 text

Testing pitfalls: performance.

Slide 34

Slide 34 text

Taking too much time? — that’s a no run.

Slide 35

Slide 35 text

Types of Testing

Slide 36

Slide 36 text

1. Testing after the implementation.

Slide 37

Slide 37 text

2. Testing during the implementation.

Slide 38

Slide 38 text

3. Testing that reproduce bugs.

Slide 39

Slide 39 text

It’s our job to build a testing culture!

Slide 40

Slide 40 text

But how?

Slide 41

Slide 41 text

5 rules.

Slide 42

Slide 42 text

1. Every change must have tests.

Slide 43

Slide 43 text

50 100 150 200 Development Unit Tests Functional Tests System Tests Production The cost of bugs

Slide 44

Slide 44 text

Bugs in production are embarrassing and costly.

Slide 45

Slide 45 text

2. Write more than unit tests.

Slide 46

Slide 46 text

Mutation testing!

Slide 47

Slide 47 text

def add(x,y) x + y end def add(x,y) x - y end Source Code Mutation

Slide 48

Slide 48 text

Property-based testing!

Slide 49

Slide 49 text

http://blog.jessitron.com/2013/04/property-based-testing-what-is-it.html

Slide 50

Slide 50 text

Contract testing!

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

Model-based testing!

Slide 53

Slide 53 text

Try formal methods! https://www.infoq.com/presentations/aws-testing-tla

Slide 54

Slide 54 text

3. Bug fixing must have tests.

Slide 55

Slide 55 text

Don’t repeat the same bug hunting — write a test!

Slide 56

Slide 56 text

4. Testing code must be reviewed.

Slide 57

Slide 57 text

A well-designed test suite is much easier to read, understand and evolve.

Slide 58

Slide 58 text

Testing code is production code!

Slide 59

Slide 59 text

5. Test suites must be consistent.

Slide 60

Slide 60 text

L12. assertEquals(input, expectation); L35. assertEquals(expectation, input); L43. assertThat(input).isEqualTo( expectation); Assertions

Slide 61

Slide 61 text

L12. assertEquals(input, expectation); L35. assertEquals(expectation, input); L43. assertThat(input).isEqualTo( expectation); Assertions

Slide 62

Slide 62 text

L12. createEntity L35. create_withValidPayload_success L43. create_withValidPayload_shouldPersistEntity Test Methods

Slide 63

Slide 63 text

L12. createEntity L35. create_withValidPayload_success L43. create_withValidPayload_shouldPersistEntity Test Methods

Slide 64

Slide 64 text

We must share the same values, practices, and tools.

Slide 65

Slide 65 text

Enforce them through code reviews, static analysis, and style checking tools.

Slide 66

Slide 66 text

Wrapping up.

Slide 67

Slide 67 text

“People who are successful at automating tasks tend to work this way in every aspect of their jobs. It is just how they work; it is part of their culture.”

Slide 68

Slide 68 text

Manual work is a bug. acmqueue | january-february 2018

Slide 69

Slide 69 text

ALWAYS BE AUTOMATING!

Slide 70

Slide 70 text

GO AND FIX YOUR BROKEN CULTURE!

Slide 71

Slide 71 text

TESTING building CULTURE