SlideShare a Scribd company logo
Being Test-Driven
It’s not really about testing
Raj Indugula George Lively
Raj.Indugula@lithespeed.com George.lively@lithespeed.com
Twitter: @lithespeed
2
What is the point of
test-driven
development?
• Driving Common Understanding
with Behavior Driven Development
• Driving Better Design with Test-
Driven Development
• Tying it all together
• Q&A
Outline
“The speed of
development is the
speed of getting an
idea from one brain to
another”
– Alistair Cockburn
3
BDD IS BUILDING
THE RIGHT THING
Behavior-Driven Development (BDD)
Behavior Driven Development (BDD)
5
Collaboration and
conversation to
discover essential
requirements and
identify uncertainty
Using rules & examples
Expressed in a common
language to build a
shared understanding
To deliver software that
matters
Behavior Driven Development (BDD)
6
Collaboration and
conversation to
discover essential
requirements and
identify uncertainty
Using rules &
examples
Expressed in a
common language to
build a shared
understanding
To deliver software that
matters
HAVE
CONVERSATIONS
BEFORE
WRITING CODE
BDD IS THE ART
OF USING RULES
& EXAMPLES IN
CONVERSATIONS
TO ILLUSTRATE
BEHAVIOR
8
9
Different Viewpoints,
Shared Understanding
9
Business, Developer, Tester
Shared understanding
All agree it is ready to be
implemented
THREE AMIGOS
9
Example Mapping, Matt Wynne
Depositor can
withdraw cash
Limited by
amount on
deposit
Subject to daily
and transaction
limits
Scenario with
sufficient
funds
Limited by daily
limit of $500
What is the
transaction
limit?
Cash is dispensed in
$10 increments with
$20 bills favored
Scenario with
insufficient
funds
Fully stocked scenario
when withdrawal of
$50 results in 2 $20
bills and 1 $10 bill
When out of $20s,
withdrawal of $50
results in 5 $10 bills
Acceptance
Scenarios
Acceptance
Criteria
10
CAPTURE THE
CONVERSATIONS TO DRIVE
DEVELOPMENT
11
Feature: ATM withdrawals
Our ATM allows depositors to withdraw their funds in cash
Rules:
Withdrawals are limited by amount on deposit
Withdrawals are subject to daily and transaction withdrawal limits
Cash is dispensed in $10 increments with $20 bills favored
Scenario: Sufficient funds allows successful withdrawal
Given a depositor has $2000 on deposit
When the depositor requests $200
Then the ATM dispenses $200
And the depositor’s balance is reduced to $1800
…
DocumentationHuman readable Structured and
keyword-based
Allows automation
Gherkin
12
AUTOMATE SPECIFICATIONS
AS NEEDED
Test
Framewor
k
Integratio
n
Gherkin
Scenarios
Specification
expressed in
common
language
Step
Definitions
“Glue” code
that ties
specification to
System under
Test
Cucumber,
SpecFlow, etc.
13
HAVING
CONVERSATIONS
>>
CAPTURING
CONVERSATIONS
>>
AUTOMATING
CONVERSATIONS
Liz Keogh
Test-Driven Development (TDD)
TDD IS BUILDING
THE THING RIGHT
Reimagine our thinking…
15
How we typically
write tests…
1. Think about
implementation
2. Write code (fields &
methods)
3. Write some test
cases to verify
behavior
Instead, what if we…
1. Write a test to capture
expected behavior?
2. Think about
implementation to meet
expectation?
3. Write code to make the
failing test pass?
Build functionality
incrementally one test at a
time…
Test-Driven Development (TDD)
16
Write a
new test
Test Fails
Write Code
Test
Passes
Clean up
code,
make sure
tests pass
start here
Style of programming
in which three
activities are tightly
interwoven: coding,
testing (in the form
of writing unit tests)
and design (in the
form of refactoring)
Developer
heartbeat
Red – Green - Refactor
Business Benefits
Requirements
verification
Regression
catching
Quicker
release cycle
Reduced
Waste
Developer Benefits
Better design
choices
Prevents gold-
plating
Confidence /
Supports
change
Momentum
Extreme Programming (XP)
- Kent Beck 19
Feedback &
Simplicity
But there’s no free lunch…
20
Here are some ways that TDD can lead to WORSE design:
• In search of speed, developers will lean too heavily on mocks, locking in
place their production code and making refactoring more difficult
• Developers will build elaborate dependency injection tools and
structures, making their design highly complex and unmaintainable.
REMEMBER: the emphasis should be on SIMPLE DESIGN, and not just for
your application code but also for your test code.
Source: https://www.jamesshore.com/Blog/How-Does-TDD-Affect-
Design.html
Source Adaptation: BDD in Action
Business Goals Features
Rules &
Examples
Executable
specifications
Low-level
specifications
Application
Code
User
stories
Only build features
that align with
business goals
Features and stories
clarified with rules
and examples
Guide development &
testing. Can be read by
whole team
Features broken
down into smaller
user stories. Help
plan how we
deliver a feature
Unit tests aimed
mostly at
developers
Automatable with BDD
tools like Cucumber,
Specflow
Unit testing tools like
JUnit, NUnit
21
Principle Activities Summarized
Source Adaptation: Raj Indugula & George Dinwiddie
Scenario: Invalid example
Given I am a new user
When I select "Abc1*$!-**" as a
password
Then I can access my account
Scenario: Cash dispensed when
machine has no $20 bills
Given the ATM is out of $20 bills
When a depositor withdraws $50
Then the ATM dispenses 5 $10 bills
22
From Test-last to Test-driven
conversations
Building the right thing
Building the thing right
23
Being test-driven isn’t really
about testing. It’s about
specification and design
driven through tests

More Related Content

PPTX
Behavior Driven Development with AngularJS & Jasmine
PPTX
Tdd 4 everyone full version
PDF
Big Ball of Mud: Software Maintenance Nightmares
PDF
BBOM-AgilePT-2010
PPTX
Designing with tests
PDF
Pair Programming, TDD and other impractical things
PPTX
Agile Software Development and Test Driven Development: Agil8's Dave Putman 3...
PPTX
Best pratice
Behavior Driven Development with AngularJS & Jasmine
Tdd 4 everyone full version
Big Ball of Mud: Software Maintenance Nightmares
BBOM-AgilePT-2010
Designing with tests
Pair Programming, TDD and other impractical things
Agile Software Development and Test Driven Development: Agil8's Dave Putman 3...
Best pratice

What's hot (20)

KEY
Getting Comfortable with BDD
PDF
Unwritten Manual for Pair Programming
PDF
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
PDF
Offshore Agile Maintenance
PPTX
How to design a 'Good' Embedded Software?
PPTX
Flavours of agile software engineering
PPTX
BDD on Java Concordion and Selenium
PPTX
Prototyping in a Scrum environment
PPTX
TDD with RSpec
PDF
Agile Prototyping for Software Development Projects
PDF
Learning Code Review & Commit Message with Google
PPT
Extreme & pair programming Slides ppt
PPTX
BDD & Beyond: The Past, Present, & Future of Test Automation
PPTX
Behavior driven development (bdd)
PDF
Introduction to bdd
PDF
Why you should integrate peer code reviews in your software company
PDF
Software craftmanship coaching
PPT
What Software Quality Assurance Means to Me
PPTX
Understanding Why Testing is Importaint
PPTX
Experience Agile Programming - Kiev
Getting Comfortable with BDD
Unwritten Manual for Pair Programming
10 Faulty Behaviors of Code Review - Developer Summit Istanbul 2018
Offshore Agile Maintenance
How to design a 'Good' Embedded Software?
Flavours of agile software engineering
BDD on Java Concordion and Selenium
Prototyping in a Scrum environment
TDD with RSpec
Agile Prototyping for Software Development Projects
Learning Code Review & Commit Message with Google
Extreme & pair programming Slides ppt
BDD & Beyond: The Past, Present, & Future of Test Automation
Behavior driven development (bdd)
Introduction to bdd
Why you should integrate peer code reviews in your software company
Software craftmanship coaching
What Software Quality Assurance Means to Me
Understanding Why Testing is Importaint
Experience Agile Programming - Kiev
Ad

Similar to Being Test-Driven: It's not really about testing (20)

PDF
Tdd 왜 배우기 어려운가
PDF
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
PPTX
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
PPTX
BDD presentation
PPT
Agile Methodologies And Extreme Programming
ODP
xUnit and TDD: Why and How in Enterprise Software, August 2012
PPTX
Improving Developer Productivity With DORA, SPACE, and DevEx
PPTX
Cucumber is a Behavior Driven Development tool used to develop test cases for...
PPTX
Agile Practices - eXtreme Programming
PPTX
Paul Ellarby - Why do scrum?
PPT
Agile Methodologies And Extreme Programming - Svetlin Nakov
PPTX
Extreme-Programming-XPllllllllllllllllllllllllllllll.pptx
PPTX
Gateway to Agile: XP and BDD
PPTX
Topic tdd-and-bdd b4usolution
PPTX
DevOpsDays Jakarta Igites
PPT
Introduction to Test Driven Development
PDF
Test driven development vs Behavior driven development
PPTX
Test driven development
PDF
TDD vs BDD_ Which Development Approach is Best for Your Project.pdf
PDF
Tdd 왜 배우기 어려운가
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
BDD presentation
Agile Methodologies And Extreme Programming
xUnit and TDD: Why and How in Enterprise Software, August 2012
Improving Developer Productivity With DORA, SPACE, and DevEx
Cucumber is a Behavior Driven Development tool used to develop test cases for...
Agile Practices - eXtreme Programming
Paul Ellarby - Why do scrum?
Agile Methodologies And Extreme Programming - Svetlin Nakov
Extreme-Programming-XPllllllllllllllllllllllllllllll.pptx
Gateway to Agile: XP and BDD
Topic tdd-and-bdd b4usolution
DevOpsDays Jakarta Igites
Introduction to Test Driven Development
Test driven development vs Behavior driven development
Test driven development
TDD vs BDD_ Which Development Approach is Best for Your Project.pdf
Ad

More from Raj Indugula (9)

PDF
Integrating AI into Test-Driven Practices.pdf
PDF
To Deliver, Discover We Must - A value-driven approach to agile planning
PDF
Yo! What’s The Scenario?
PDF
Be Ready, Be Done: The Art of Slicing Stories
PDF
What's Measured Improves: Metrics that matter
PDF
Dare to Explore: Discover ET!
PDF
Leanstartuptoolsforproductowners
PDF
Agile testing
PDF
Effective Testing Practices in an Agile Environment
Integrating AI into Test-Driven Practices.pdf
To Deliver, Discover We Must - A value-driven approach to agile planning
Yo! What’s The Scenario?
Be Ready, Be Done: The Art of Slicing Stories
What's Measured Improves: Metrics that matter
Dare to Explore: Discover ET!
Leanstartuptoolsforproductowners
Agile testing
Effective Testing Practices in an Agile Environment

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
Machine Learning_overview_presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation theory and applications.pdf
Spectral efficient network and resource selection model in 5G networks
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation

Being Test-Driven: It's not really about testing

  • 1. Being Test-Driven It’s not really about testing Raj Indugula George Lively Raj.Indugula@lithespeed.com George.lively@lithespeed.com Twitter: @lithespeed
  • 2. 2 What is the point of test-driven development?
  • 3. • Driving Common Understanding with Behavior Driven Development • Driving Better Design with Test- Driven Development • Tying it all together • Q&A Outline “The speed of development is the speed of getting an idea from one brain to another” – Alistair Cockburn 3
  • 4. BDD IS BUILDING THE RIGHT THING Behavior-Driven Development (BDD)
  • 5. Behavior Driven Development (BDD) 5 Collaboration and conversation to discover essential requirements and identify uncertainty Using rules & examples Expressed in a common language to build a shared understanding To deliver software that matters
  • 6. Behavior Driven Development (BDD) 6 Collaboration and conversation to discover essential requirements and identify uncertainty Using rules & examples Expressed in a common language to build a shared understanding To deliver software that matters
  • 8. BDD IS THE ART OF USING RULES & EXAMPLES IN CONVERSATIONS TO ILLUSTRATE BEHAVIOR 8
  • 9. 9 Different Viewpoints, Shared Understanding 9 Business, Developer, Tester Shared understanding All agree it is ready to be implemented THREE AMIGOS 9 Example Mapping, Matt Wynne Depositor can withdraw cash Limited by amount on deposit Subject to daily and transaction limits Scenario with sufficient funds Limited by daily limit of $500 What is the transaction limit? Cash is dispensed in $10 increments with $20 bills favored Scenario with insufficient funds Fully stocked scenario when withdrawal of $50 results in 2 $20 bills and 1 $10 bill When out of $20s, withdrawal of $50 results in 5 $10 bills Acceptance Scenarios Acceptance Criteria
  • 10. 10 CAPTURE THE CONVERSATIONS TO DRIVE DEVELOPMENT
  • 11. 11 Feature: ATM withdrawals Our ATM allows depositors to withdraw their funds in cash Rules: Withdrawals are limited by amount on deposit Withdrawals are subject to daily and transaction withdrawal limits Cash is dispensed in $10 increments with $20 bills favored Scenario: Sufficient funds allows successful withdrawal Given a depositor has $2000 on deposit When the depositor requests $200 Then the ATM dispenses $200 And the depositor’s balance is reduced to $1800 … DocumentationHuman readable Structured and keyword-based Allows automation Gherkin
  • 12. 12 AUTOMATE SPECIFICATIONS AS NEEDED Test Framewor k Integratio n Gherkin Scenarios Specification expressed in common language Step Definitions “Glue” code that ties specification to System under Test Cucumber, SpecFlow, etc.
  • 14. Test-Driven Development (TDD) TDD IS BUILDING THE THING RIGHT
  • 15. Reimagine our thinking… 15 How we typically write tests… 1. Think about implementation 2. Write code (fields & methods) 3. Write some test cases to verify behavior Instead, what if we… 1. Write a test to capture expected behavior? 2. Think about implementation to meet expectation? 3. Write code to make the failing test pass? Build functionality incrementally one test at a time…
  • 16. Test-Driven Development (TDD) 16 Write a new test Test Fails Write Code Test Passes Clean up code, make sure tests pass start here Style of programming in which three activities are tightly interwoven: coding, testing (in the form of writing unit tests) and design (in the form of refactoring) Developer heartbeat Red – Green - Refactor
  • 18. Developer Benefits Better design choices Prevents gold- plating Confidence / Supports change Momentum
  • 19. Extreme Programming (XP) - Kent Beck 19 Feedback & Simplicity
  • 20. But there’s no free lunch… 20 Here are some ways that TDD can lead to WORSE design: • In search of speed, developers will lean too heavily on mocks, locking in place their production code and making refactoring more difficult • Developers will build elaborate dependency injection tools and structures, making their design highly complex and unmaintainable. REMEMBER: the emphasis should be on SIMPLE DESIGN, and not just for your application code but also for your test code. Source: https://www.jamesshore.com/Blog/How-Does-TDD-Affect- Design.html
  • 21. Source Adaptation: BDD in Action Business Goals Features Rules & Examples Executable specifications Low-level specifications Application Code User stories Only build features that align with business goals Features and stories clarified with rules and examples Guide development & testing. Can be read by whole team Features broken down into smaller user stories. Help plan how we deliver a feature Unit tests aimed mostly at developers Automatable with BDD tools like Cucumber, Specflow Unit testing tools like JUnit, NUnit 21 Principle Activities Summarized
  • 22. Source Adaptation: Raj Indugula & George Dinwiddie Scenario: Invalid example Given I am a new user When I select "Abc1*$!-**" as a password Then I can access my account Scenario: Cash dispensed when machine has no $20 bills Given the ATM is out of $20 bills When a depositor withdraws $50 Then the ATM dispenses 5 $10 bills 22 From Test-last to Test-driven conversations Building the right thing Building the thing right
  • 23. 23 Being test-driven isn’t really about testing. It’s about specification and design driven through tests