Your SlideShare is downloading. ×
0
© Schalk W. Cronjé Bangalore July 2013
Real World TDD
Schalk W. Cronjé
@ysb33r
ysb33r@gmail.com
© Schalk W. Cronjé Bangalore July 2013
Following a process / using TDD
does not make your testing agile
© Schalk W. Cronjé Bangalore July 2013
You can accept just to do what you are told
or you can decide to be better ...
Imag...
© Schalk W. Cronjé Bangalore July 2013
TDD?
Test-driven Development ?
Test-driven Design ?
© Schalk W. Cronjé Bangalore July 2013
Myth #1
TDD is writing tests
before production code
© Schalk W. Cronjé Bangalore July 2013
London School of Thought
TDD is growing code,
guided by tests
© Schalk W. Cronjé Bangalore July 2013
Myth #2
TDD is only about writing unit tests
© Schalk W. Cronjé Bangalore July 2013
TDD is growing code ...
guided by
unit tests,
integration tests,
functional tests,
...
© Schalk W. Cronjé Bangalore July 2013
Myth #3
Test code does not have
to be well-written
© Schalk W. Cronjé Bangalore July 2013
The test system is as important
as the production code
http://dhemery.com/pdf/test-...
© Schalk W. Cronjé Bangalore July 2013
Lean Startup Exception
In short-lived production code,
don't bother with TDD
unless...
© Schalk W. Cronjé Bangalore July 2013
Myth #4
TDD is only for new code
© Schalk W. Cronjé Bangalore July 2013
You can decide to be better ...
need a code change?
write a test first,
ensure it p...
© Schalk W. Cronjé Bangalore July 2013
Gärtner's Cultural Patterns of Agile Testing
Separation
Pipelining
Mini-waterfalls
...
© Schalk W. Cronjé Bangalore July 2013
delivered
build
Time Factors in Legacy Testing
Feature 3 Dev
Feature 2 Dev
Feature ...
© Schalk W. Cronjé Bangalore July 2013
Test specification up front
Now everyone knows what we plan to test
© Schalk W. Cronjé Bangalore July 2013
Integrate Developers-Testers into pairs
Shared problem-solving leads
to reduced cyc...
© Schalk W. Cronjé Bangalore July 2013
Expressive Test Style
def "'and' should join groups when the thousands multiplier i...
© Schalk W. Cronjé Bangalore July 2013
Build a walking skeleton before
any (more) features are written
Do the difficult wh...
© Schalk W. Cronjé Bangalore July 2013
One class
One unit test
One integration test
One deployment script
Continuous Integ...
© Schalk W. Cronjé Bangalore July 2013
Advanced CI Orchestration
Expensive test sets should be
downstream and parallellise...
© Schalk W. Cronjé Bangalore July 2013
Conclusion
● There is more than one way
● Think big (beyond unit tests)
● Be the on...
© Schalk W. Cronjé Bangalore July 2013
Real World TDD
Schalk W. Cronjé
@ysb33r
ysb33r @ gmail.com
Upcoming SlideShare
Loading in...5
×

Real World TDD

480

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
480
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Real World TDD"

  1. 1. © Schalk W. Cronjé Bangalore July 2013 Real World TDD Schalk W. Cronjé @ysb33r ysb33r@gmail.com
  2. 2. © Schalk W. Cronjé Bangalore July 2013 Following a process / using TDD does not make your testing agile
  3. 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. 4. © Schalk W. Cronjé Bangalore July 2013 TDD? Test-driven Development ? Test-driven Design ?
  5. 5. © Schalk W. Cronjé Bangalore July 2013 Myth #1 TDD is writing tests before production code
  6. 6. © Schalk W. Cronjé Bangalore July 2013 London School of Thought TDD is growing code, guided by tests
  7. 7. © Schalk W. Cronjé Bangalore July 2013 Myth #2 TDD is only about writing unit tests
  8. 8. © Schalk W. Cronjé Bangalore July 2013 TDD is growing code ... guided by unit tests, integration tests, functional tests, deployment tests
  9. 9. © Schalk W. Cronjé Bangalore July 2013 Myth #3 Test code does not have to be well-written
  10. 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. 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. 12. © Schalk W. Cronjé Bangalore July 2013 Myth #4 TDD is only for new code
  13. 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. 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. 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. 16. © Schalk W. Cronjé Bangalore July 2013 Test specification up front Now everyone knows what we plan to test
  17. 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. 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. 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. 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. 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. 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. 23. © Schalk W. Cronjé Bangalore July 2013 Real World TDD Schalk W. Cronjé @ysb33r ysb33r @ gmail.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×