Slide 1

Slide 1 text

Listening to the tests Hibri Marzook @hibri [email protected] 1 Thursday, 13 December 12

Slide 2

Slide 2 text

What do tests tell us ? • What other things than a red or a green do tests tell us ? • How do we know TDD is working for us ? 2 Thursday, 13 December 12

Slide 3

Slide 3 text

The Testing Triangle 3 Thursday, 13 December 12

Slide 4

Slide 4 text

Before you write a test 4 Thursday, 13 December 12

Slide 5

Slide 5 text

Before you write a test • Can you run your tests, after a clean checkout and get a green bar ? 4 Thursday, 13 December 12

Slide 6

Slide 6 text

Before you write a test • Can you run your tests, after a clean checkout and get a green bar ? • If you have to fiddle with other things before you run tests, your time to get feedback is increased 4 Thursday, 13 December 12

Slide 7

Slide 7 text

Before you write a test • Can you run your tests, after a clean checkout and get a green bar ? • If you have to fiddle with other things before you run tests, your time to get feedback is increased • How many times do you have to ask others “who is running tests on the dev server ? “ 4 Thursday, 13 December 12

Slide 8

Slide 8 text

Before you write a test • Can you run your tests, after a clean checkout and get a green bar ? • If you have to fiddle with other things before you run tests, your time to get feedback is increased • How many times do you have to ask others “who is running tests on the dev server ? “ • Do you have a build token when checking in? 4 Thursday, 13 December 12

Slide 9

Slide 9 text

Before you write a test • Can you run your tests, after a clean checkout and get a green bar ? • If you have to fiddle with other things before you run tests, your time to get feedback is increased • How many times do you have to ask others “who is running tests on the dev server ? “ • Do you have a build token when checking in? • Do you have to tell your QA to stop testing while you deploy ? 4 Thursday, 13 December 12

Slide 10

Slide 10 text

While writing • Writing a new test, in a green field project is easy. • Writing for existing code is hard 5 Thursday, 13 December 12

Slide 11

Slide 11 text

Test smells 6 Thursday, 13 December 12

Slide 12

Slide 12 text

Test smells • Too many expectations, asserts in one test 6 Thursday, 13 December 12

Slide 13

Slide 13 text

Test smells • Too many expectations, asserts in one test • Mocktastic tests. 6 Thursday, 13 December 12

Slide 14

Slide 14 text

Test smells • Too many expectations, asserts in one test • Mocktastic tests. • Large setup methods 6 Thursday, 13 December 12

Slide 15

Slide 15 text

Test smells • Too many expectations, asserts in one test • Mocktastic tests. • Large setup methods • Copy and pasting tests 6 Thursday, 13 December 12

Slide 16

Slide 16 text

Test smells • Too many expectations, asserts in one test • Mocktastic tests. • Large setup methods • Copy and pasting tests • Teardown methods 6 Thursday, 13 December 12

Slide 17

Slide 17 text

Test smells • Too many expectations, asserts in one test • Mocktastic tests. • Large setup methods • Copy and pasting tests • Teardown methods • Duplication between test fixtures 6 Thursday, 13 December 12

Slide 18

Slide 18 text

Writing tests 7 Thursday, 13 December 12

Slide 19

Slide 19 text

Writing tests • Tests are complex when the underlying code is complex 7 Thursday, 13 December 12

Slide 20

Slide 20 text

Writing tests • Tests are complex when the underlying code is complex • Symptoms : mockery, complex setup, too many tests per unit 7 Thursday, 13 December 12

Slide 21

Slide 21 text

Writing tests • Tests are complex when the underlying code is complex • Symptoms : mockery, complex setup, too many tests per unit • Writing a test should be easy, if it is hard, the code being tested could be complex. 7 Thursday, 13 December 12

Slide 22

Slide 22 text

Writing tests • Tests are complex when the underlying code is complex • Symptoms : mockery, complex setup, too many tests per unit • Writing a test should be easy, if it is hard, the code being tested could be complex. • Complex code can be written even when doing TDD. 7 Thursday, 13 December 12

Slide 23

Slide 23 text

Writing tests • Tests are complex when the underlying code is complex • Symptoms : mockery, complex setup, too many tests per unit • Writing a test should be easy, if it is hard, the code being tested could be complex. • Complex code can be written even when doing TDD. • When you are having a hard time writing a test, pay attention to the code. 7 Thursday, 13 December 12

Slide 24

Slide 24 text

After running tests 8 Thursday, 13 December 12

Slide 25

Slide 25 text

After running tests • How long do they run for ? 8 Thursday, 13 December 12

Slide 26

Slide 26 text

After running tests • How long do they run for ? • Do they fail for the right reasons ? 8 Thursday, 13 December 12

Slide 27

Slide 27 text

After running tests • How long do they run for ? • Do they fail for the right reasons ? • Do you have to parse a stack trace in your head to find out why your tests failed ? 8 Thursday, 13 December 12

Slide 28

Slide 28 text

After running tests 9 Thursday, 13 December 12

Slide 29

Slide 29 text

After running tests • How many tests do you have? 9 Thursday, 13 December 12

Slide 30

Slide 30 text

After running tests • How many tests do you have? • How long did they take ? 9 Thursday, 13 December 12

Slide 31

Slide 31 text

After running tests • How many tests do you have? • How long did they take ? • Watch the stats 9 Thursday, 13 December 12

Slide 32

Slide 32 text

To end.. 10 Thursday, 13 December 12

Slide 33

Slide 33 text

To end.. • Think about what value your tests are giving you ? 10 Thursday, 13 December 12

Slide 34

Slide 34 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? 10 Thursday, 13 December 12

Slide 35

Slide 35 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? • Are they helping you deliver faster and reliably ? 10 Thursday, 13 December 12

Slide 36

Slide 36 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? • Are they helping you deliver faster and reliably ? • Does your team see tests are a chore or as an aid ? 10 Thursday, 13 December 12

Slide 37

Slide 37 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? • Are they helping you deliver faster and reliably ? • Does your team see tests are a chore or as an aid ? • If you are not getting the benefits of TDD, don’t do it. 10 Thursday, 13 December 12

Slide 38

Slide 38 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? • Are they helping you deliver faster and reliably ? • Does your team see tests are a chore or as an aid ? • If you are not getting the benefits of TDD, don’t do it. • Do something else that will let you deliver faster and reliably. 10 Thursday, 13 December 12

Slide 39

Slide 39 text

To end.. • Think about what value your tests are giving you ? • Are they giving you the feedback you need ? • Are they helping you deliver faster and reliably ? • Does your team see tests are a chore or as an aid ? • If you are not getting the benefits of TDD, don’t do it. • Do something else that will let you deliver faster and reliably. • If you do, I’d like to know what it is. 10 Thursday, 13 December 12

Slide 40

Slide 40 text

Questions and your views 11 Thursday, 13 December 12