Your SlideShare is downloading. ×
TDD refresher
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

TDD refresher

408
views

Published on

TDD talk for new grad

TDD talk for new grad


0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
408
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Test-drivendevelopment Kerry Buckley 2 November 2012
    • 2. TDD refresher
    • 3. Towards TDD 0. manual testing WriteDesign Test Release code
    • 4. Towards TDD 1. automated testing Write WriteDesign Test Release code tests
    • 5. Towards TDD 2. test-first development Write WriteDesign Test Release tests code
    • 6. Towards TDD 3. test-driven developmentDesign Write Run Write test test code Release Run Refactor tests
    • 7. Towards TDD3. test-driven development Red Green Refactor
    • 8. Beyond TDD? 4. behaviour-driven development ExecutableCustomer Release examples Red Green TDD Refactor
    • 9. Types of test
    • 10. Acceptance tests Test System
    • 11. Integrated tests Test Test
    • 12. Unit tests Test TestMock Mock Mock
    • 13. Anatomy of a test # Given some test accounts➊ Setup account_1 = Account.new(100) account_2 = Account.new(50) # When I transfer money➋ Act transfer(20, from: account_1, to: account_2) # Then the balances should be updated➌ Assert account_1.balance.should eq(80) account_2.balance.should eq(70)
    • 14. A good test…
    • 15. A good test…• Expresses the programmer’s intent
    • 16. A good test…• Expresses the programmer’s intent• Gives confidence that the code works
    • 17. A good test…• Expresses the programmer’s intent• Gives confidence that the code works• Only tests one thing
    • 18. A good test…• Expresses the programmer’s intent• Gives confidence that the code works• Only tests one thing• Gives clear failure message
    • 19. A good test…• Expresses the programmer’s intent• Gives confidence that the code works• Only tests one thing• Gives clear failure message• Is independent of other tests
    • 20. A good test suite…
    • 21. A good test suite…• Gives confidence that the system works
    • 22. A good test suite…• Gives confidence that the system works• Runs quickly
    • 23. A good test suite…• Gives confidence that the system works• Runs quickly• Is well-maintained
    • 24. A good test suite…• Gives confidence that the system works• Runs quickly• Is well-maintained• Isolates each area under test
    • 25. Benefits of TDD
    • 26. Benefits of TDD• Less manual testing required
    • 27. Benefits of TDD• Less manual testing required• Faster feedback
    • 28. Benefits of TDD• Less manual testing required• Faster feedback• Make it safe to change code
    • 29. Benefits of TDD• Less manual testing required• Faster feedback• Make it safe to change code• Reduced rework and debugging
    • 30. Benefits of TDD• Less manual testing required• Faster feedback• Make it safe to change code• Reduced rework and debugging• Improved design
    • 31. How do I start?
    • 32. How do I start?• Greenfield project? JFDI! Otherwise…
    • 33. How do I start?• Greenfield project? JFDI! Otherwise…• Automate highest value tests first
    • 34. How do I start?• Greenfield project? JFDI! Otherwise…• Automate highest value tests first • Important features
    • 35. How do I start?• Greenfield project? JFDI! Otherwise…• Automate highest value tests first • Important features • Where the most bugs occur
    • 36. How do I start?• Greenfield project? JFDI! Otherwise…• Automate highest value tests first • Important features • Where the most bugs occur• Use TDD for new features
    • 37. How do I start?• Greenfield project? JFDI! Otherwise…• Automate highest value tests first • Important features • Where the most bugs occur• Use TDD for new features• Add tests for bugs when they’re found
    • 38. Further reading