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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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