Real World TDD
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Real World TDD

on

  • 639 views

 

Statistics

Views

Total Views
639
Views on SlideShare
608
Embed Views
31

Actions

Likes
0
Downloads
7
Comments
0

3 Embeds 31

http://54.225.83.16 27
https://twitter.com 3
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Real World TDD Presentation Transcript

  • 1. © Schalk W. Cronjé Bangalore July 2013 Real World TDD Schalk W. Cronjé @ysb33r ysb33r@gmail.com
  • 2. © Schalk W. Cronjé Bangalore July 2013 Following a process / using TDD does not make your testing agile
  • 3. © Schalk W. Cronjé Bangalore July 2013 You can accept just to do what you are told or you can decide to be better ... Image: http://bit.ly/12FKyID
  • 4. © Schalk W. Cronjé Bangalore July 2013 TDD? Test-driven Development ? Test-driven Design ?
  • 5. © Schalk W. Cronjé Bangalore July 2013 Myth #1 TDD is writing tests before production code
  • 6. © Schalk W. Cronjé Bangalore July 2013 London School of Thought TDD is growing code, guided by tests
  • 7. © Schalk W. Cronjé Bangalore July 2013 Myth #2 TDD is only about writing unit tests
  • 8. © Schalk W. Cronjé Bangalore July 2013 TDD is growing code ... guided by unit tests, integration tests, functional tests, deployment tests
  • 9. © Schalk W. Cronjé Bangalore July 2013 Myth #3 Test code does not have to be well-written
  • 10. © Schalk W. Cronjé Bangalore July 2013 The test system is as important as the production code http://dhemery.com/pdf/test-automation-zombie- apocalypse.pdf
  • 11. © Schalk W. Cronjé Bangalore July 2013 Lean Startup Exception In short-lived production code, don't bother with TDD unless … It helps you solve the problem
  • 12. © Schalk W. Cronjé Bangalore July 2013 Myth #4 TDD is only for new code
  • 13. © Schalk W. Cronjé Bangalore July 2013 You can decide to be better ... need a code change? write a test first, ensure it passes, break it, fix it, make the change add code coverage
  • 14. © Schalk W. Cronjé Bangalore July 2013 Gärtner's Cultural Patterns of Agile Testing Separation Pipelining Mini-waterfalls Integrated Continuous http://www.ministryoftesting.com/2013/07/cultural-patterns-in-agile-testing/
  • 15. © Schalk W. Cronjé Bangalore July 2013 delivered build Time Factors in Legacy Testing Feature 3 Dev Feature 2 Dev Feature 4 Dev Feature 1 Dev Bug DB Feature 1 QA Feature 2 QA Feature 3 QA Feature 4 QA defect trickle feed Feature 5+ Dev Feature 5+ QA delivered build Retest fixes QA understanding specs time from raising defect until it is available for testing Building test infrastructure time to re-test basic build verification
  • 16. © Schalk W. Cronjé Bangalore July 2013 Test specification up front Now everyone knows what we plan to test
  • 17. © Schalk W. Cronjé Bangalore July 2013 Integrate Developers-Testers into pairs Shared problem-solving leads to reduced cycle-time “Two are better then, because they have good reward for their labor: If either falls down, one can help the other up. But pity anyone who falls and has no one to help them up”. Ecclesiastes 4:9-10 NIV Translation ~ 971 – 931 BC
  • 18. © Schalk W. Cronjé Bangalore July 2013 Expressive Test Style def "'and' should join groups when the thousands multiplier is not a multiple of one hundred" () { expect: EnglishNumbers.format( number ) == english_wording where: number | english_wording 120_000 | "one hundred and twenty thousand" 323_000 | "three hundred and twenty three thousand" } See also: BDD, ATDD, Specification by Example
  • 19. © Schalk W. Cronjé Bangalore July 2013 Build a walking skeleton before any (more) features are written Do the difficult whilst it is easy – Sun Tzu, “Art of War” ~ 512 BC Image: http://bit.ly/15BTxMI
  • 20. © Schalk W. Cronjé Bangalore July 2013 One class One unit test One integration test One deployment script Continuous Integration Auto-deployment Deployment-driven development
  • 21. © Schalk W. Cronjé Bangalore July 2013 Advanced CI Orchestration Expensive test sets should be downstream and parallellised http://delivervalue.blogspot.co.uk/2013/06/more-advanced-build-flows-with- jenkins.html
  • 22. © Schalk W. Cronjé Bangalore July 2013 Conclusion ● There is more than one way ● Think big (beyond unit tests) ● Be the one that makes the difference
  • 23. © Schalk W. Cronjé Bangalore July 2013 Real World TDD Schalk W. Cronjé @ysb33r ysb33r @ gmail.com