Post on 05-Dec-2014
description
© Schalk W. Cronjé Bangalore July 2013
Real World TDDSchalk W. Cronjé
@ysb33rysb33r@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 ...
Image: http://bit.ly/12FKyID
© 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,
deployment 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-automation-zombie-apocalypse.pdf
© 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
© 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 passes,
break it, fix it,
make the change
add code coverage
© 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/
© Schalk W. Cronjé Bangalore July 2013
deliveredbuild
Time Factors in Legacy Testing
Feature 3 Dev
Feature 2 Dev
Feature 4 Dev
Feature 1 Dev
BugDB
Feature 1 QA
Feature 2 QA
Feature 3 QA
Feature 4 QA
defect trickle feed
Feature 5+ Dev
Feature 5+ QA
deliveredbuild
Retest fixes QA
understandingspecs
time from raising defect until it is available for testing
Building testinfrastructure
time tore-test
basic buildverification
© 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 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
© Schalk W. Cronjé Bangalore July 2013
Expressive Test Styledef "'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
© 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
© Schalk W. Cronjé Bangalore July 2013
One class One unit test One integration test One deployment script Continuous Integration Auto-deployment
Deployment-driven development
© Schalk W. Cronjé Bangalore July 2013
Advanced CI Orchestration
Expensive test sets should bedownstream and parallellised
http://delivervalue.blogspot.co.uk/2013/06/more-advanced-build-flows-with-jenkins.html
© 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
© Schalk W. Cronjé Bangalore July 2013
Real World TDDSchalk W. Cronjé
@ysb33rysb33r @ gmail.com