Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Listening to the tests

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

Hibri Marzook

September 13, 2012
Tweet

More Decks by Hibri Marzook

Other Decks in Programming

Transcript

  1. 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
  2. Before you write a test • Can you run your

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

    field project is easy. • Writing for existing code is hard 5 Thursday, 13 December 12
  8. Test smells • Too many expectations, asserts in one test

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

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

    • Mocktastic tests. • Large setup methods • Copy and pasting tests 6 Thursday, 13 December 12
  11. 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
  12. 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
  13. Writing tests • Tests are complex when the underlying code

    is complex 7 Thursday, 13 December 12
  14. 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
  15. 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
  16. 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
  17. 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
  18. After running tests • How long do they run for

    ? • Do they fail for the right reasons ? 8 Thursday, 13 December 12
  19. 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
  20. After running tests • How many tests do you have?

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

    • How long did they take ? • Watch the stats 9 Thursday, 13 December 12
  22. To end.. • Think about what value your tests are

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

    giving you ? • Are they giving you the feedback you need ? 10 Thursday, 13 December 12
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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