test first development... impact on traditional roles
TRANSCRIPT
Test First Development Impact on Traditional Testing Roles
Gaurav Maheshwari
[email protected], @g_maheshwari
TL Spectrum Consulting Pvt. Ltd. (http://www.tlspectrum.com)
Test First Development Impact on Traditional Testing Roles
Image credit: Google Image with respective trademarks
75% 25%
Software Maintenance
Source: Software Maintenance (Wikipedia) , Estimating Software Maintenance, Prof M Glinz, University of Zurich
Lientz and Swanson (1980)
Corrective 22%
Adaptive 24%
Perfective 51%
Preventive 3%
Quality
Works as Expected
Responsive, Easy to Use
Reliable, Accurate
Predictable
…
Easy to Understand
Easy to Change
Testable
Modular, Readable
…
External Quality Internal Quality
Customers Developers
Purpose of Software Design of Software
Reference: GoodCode, Structure & Interpretation of Computer Programs, MIT Press
“Programs must be written for people to read, and only
incidentally for machines to execute” - Abelson & Sussman,
Development Flow
Code
High-level design
architecture
High-level design
architecture Detailed Design Detailed Design Code Code Unit Test Unit Test Test Test
(a)
Design & Code
High-level design
architecture
High-level design
architecture Unit Test Unit Test Code Code Refactor Refactor Test Test
(c)
Development Flow: (a) (b) Traditional test-last and (c) Test-First (TDD) flow
Code
High-level design
architecture
High-level design
architecture Detailed Design Detailed Design Code Code UT, CR, SA, CC UT, CR, SA, CC Test, CC Test, CC
(b)
Test Driven Development (TDD)
Red
Green Gold/
Refactor
Write a simple test & make it fail
Test as example code, technical
documentation
No external dependency
Get to green fast, simple steps
Just enough code to pass the test
Clean up, Remove Duplication,
Restructure, Optimize
Run the tests and keep them “Green”
What to build ?
Who is going to use it and how ?
How to test ? Different Scenarios ?
TDD in Action – Demo
User story, Acceptance Criteria
As a [X]
So that [Z]
I want [Y]
-- person (role) who will benefit
-- benefit or business value
-- feature
Given
Then
When
-- some initial context (the givens)
-- ensure some outcomes
-- an event occurs
Examples
What if these Acceptance
criterions are executable?
Behavior Driven Development (BDD)
Source: Dan North Blog : Introducing BDD
PO
Dev Team Customer
Requirements to Design to Code to Product Translation Cycle
BDD – TDD Working Together
Dev Cycle
TDD
BDD
Customer, PO, Dev, Test –
Sharing understanding by
discussing specific examples
Improved internal code quality
What’s in it for me, the Tester ?
• Focus beyond basic sanity
• Improved
– Internal quality, and external quality
– Testability
• Put testing on behalf of the user
• Automated test as production code
• Testers as
– Design consultants
– Partners
– Domain experts
• Demonstrate value by going Upstream!
Testers Behaviour
Developers Design,
Coding