16
TEST DRIVEN IS DRIVING ME INSANE! Practical Test Patterns

Test Driven is Driving Me Insane!

Embed Size (px)

DESCRIPTION

Now that you have decided to integrate testing into your development process, you find that when one test breaks, it seems like they all break. You also find that with so many tests broken, identifying the source of failed tests is challenging. Another challenge is that occasionally, tests are just plain hard to write. In this session we will discuss patterns and techniques for writing tests that are more robust and provide better information. This includes techniques that you can apply to your design when writing new code to make testing easier, as well as tools for working with existing applications that do not have good test coverage.

Citation preview

Page 1: Test Driven is Driving Me Insane!

TEST DRIVEN IS DRIVING ME INSANE!

Practical Test Patterns

Page 2: Test Driven is Driving Me Insane!

Who?

Dennis BurtonSRT SolutionsDevelopUsing.net || DennisBurton.com@dburton

Feedback:http://speakerrate.com/dennisburtonhttp://speakerrate.com/events/131-codestock

Page 3: Test Driven is Driving Me Insane!

The Primer

Page 4: Test Driven is Driving Me Insane!

All 10 of my tests rock

Page 5: Test Driven is Driving Me Insane!

Code changes seem to take longer

Page 6: Test Driven is Driving Me Insane!

Long running tests

Page 7: Test Driven is Driving Me Insane!

Tests take longer to set up

Page 8: Test Driven is Driving Me Insane!

Test are fragile

Page 9: Test Driven is Driving Me Insane!

Tests depend on specific (often production) data

Page 10: Test Driven is Driving Me Insane!

Position Statement - Uncle Bob Martin

…it has become my position that TDD is a necessary discipline for professional developers. I consider it rather like sterile procedure for doctors. It's simply what you have to do to write professional code. (At least it's what I have to do.)

-ButUncleBob.com

Page 11: Test Driven is Driving Me Insane!
Page 12: Test Driven is Driving Me Insane!

What am I missing?

Page 13: Test Driven is Driving Me Insane!

But, I already have some legacy code not under test

Page 14: Test Driven is Driving Me Insane!

References

xUnit Test Patterns Working Effectivelywith

Legacy Code

Page 15: Test Driven is Driving Me Insane!

Dummy – An object is required that shouldn’t be

Spy – Add the validation an object should have had

Stub – The state of an object is important to the test

Mock – behavior is what is really under test

Use Rhino or Moq Don’t tolerate test pain

Page 16: Test Driven is Driving Me Insane!

Questions

Dennis BurtonSRT SolutionsDevelopUsing.net || DennisBurton.com@dburtonFeedback:http://speakerrate.com/dennisburtonhttp://speakerrate.com/events/131-codestock