Listening to the tests

80574e8bd66d0806b027fa03dc16dbe0?s=47 Hibri Marzook
September 13, 2012

Listening to the tests

A talk on what the practicing TDD tells you about how you, the team and the software you build

80574e8bd66d0806b027fa03dc16dbe0?s=128

Hibri Marzook

September 13, 2012
Tweet

Transcript

  1. Listening to the tests Hibri Marzook @hibri hibri@hibri.net 1 Thursday,

    13 December 12
  2. 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
  3. The Testing Triangle 3 Thursday, 13 December 12

  4. Before you write a test 4 Thursday, 13 December 12

  5. Before you write a test • Can you run your

    tests, after a clean checkout and get a green bar ? 4 Thursday, 13 December 12
  6. 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
  7. 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
  8. 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
  9. 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
  10. While writing • Writing a new test, in a green

    field project is easy. • Writing for existing code is hard 5 Thursday, 13 December 12
  11. Test smells 6 Thursday, 13 December 12

  12. Test smells • Too many expectations, asserts in one test

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

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

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

    • Mocktastic tests. • Large setup methods • Copy and pasting tests 6 Thursday, 13 December 12
  16. 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
  17. 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
  18. Writing tests 7 Thursday, 13 December 12

  19. Writing tests • Tests are complex when the underlying code

    is complex 7 Thursday, 13 December 12
  20. 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
  21. 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
  22. 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
  23. 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
  24. After running tests 8 Thursday, 13 December 12

  25. After running tests • How long do they run for

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

    ? • Do they fail for the right reasons ? 8 Thursday, 13 December 12
  27. 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
  28. After running tests 9 Thursday, 13 December 12

  29. After running tests • How many tests do you have?

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

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

    • How long did they take ? • Watch the stats 9 Thursday, 13 December 12
  32. To end.. 10 Thursday, 13 December 12

  33. To end.. • Think about what value your tests are

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

    giving you ? • Are they giving you the feedback you need ? 10 Thursday, 13 December 12
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. Questions and your views 11 Thursday, 13 December 12