SlideShare a Scribd company logo
Intro	
  to	
  TDD	
  &	
  BDD

Test Driven Development 

& Behaviour Driven Development
Kev McCabe
In to The Box 2015
Sunday, 19 April 15
Who am I?
• Kev McCabe AKA @bigmadkev
• Freelance Code Smith 

& Agile Coach
• Developer for over 18 years
• Worked in TV Broadcast,
Healthcare, Travel & Finance
• Adobe Community Professional
Agenda
• Types of testing
• Why Test
• TDD Intro
• BDD Intro
• TestBox BDD
Types of Testing
GUI
Integration
Unit Tests
Exploratory
testing
Real World Testing Pyramid
GUI
Integration
Exploratory testing
Unit TestsManual Testing
Bugs cost money
^ Kaner,Cem; JamesBach, Bret Pettichord (2001). Lessons Learned inSoftwareTesting: A Context-Driven Approach.Wiley. p. 4. ISBN 0-471-08112-4.
One Big Lie!
What is TDD
Test-driven development (TDD) is a software
development process that relies on the
repetition of a very short development cycle:
first the developer writes an (initially failing)
automated test case that defines a desired
improvement or new function, then
produces the minimum amount of code to
pass that test, and finally refactors the new code
to acceptable standards
What is TDD
What it is
• A tool to drive design
• Developer focused
• Works with BDD
• Non-intuitive but powerful
tool
What it is not
• About testing
• For the faint hearted
• A silver bullet
• Easy
TDD Process
From	
  Growing	
  Object-­‐Oriented	
  Software	
  by	
  Nat	
  Pryce	
  and	
  Steve	
  Freeman
What is BDD
In software engineering, behavior-driven development
(BDD) is a software development process that
emerged from test-driven development (TDD).Behavior-
driven development combines the general techniques and
principles of TDD with ideas from domain-driven
design and object-oriented analysis and design to
provide software developers and business analysts
with shared tools and a shared process to
collaborate on software development, with the aim of
delivering “software that matters”
What is BDD
• Dan North - http://dannorth.net/introducing-bdd
• Ubiquitous language
– existing or being everywhere at the same time : constantly
• Promotes communication & collaboration between
– Developers + business analysts + stakeholders
• Focuses on stories or requirements rather than on functions
• Focuses on what a system should do and not on how it should be
implemented
– Better readability and visibility
– Verify that software works but also that it meets customer
expectations
BDD Process
Story
Generate Scenarios
Pass Scenarios
Generating Scenarios
As an Insurance Company,
I want to generate life insurance risk
so that we don’t lose money
Example 3 Amigos Session
In order to not lose money
as an insurance company,
I want to generate life insurance risk
Example 3 Amigos Session
Scenario One
Given a customer
When they request a quote
Then we return an insurance risk
BDD
User stories &
acceptance
criteria
Domain
Learning
Examples
Examples
Examples
Examples
Examples
Open
Questions
New Stories
Scenario One
Given a customer under 30 years
When they request a life insurance quote
Then we return an insurance risk of low
Given a customer under 55 years
When they request a life insurance quote
Then we return an insurance risk of med
Scenario Two
Given a customer over 55 years
When they request a life insurance quote
Then we return an insurance risk of high
Scenario Three
Given a customer between 

<lowerLimit> & <upperLimit>
When they request a life insurance quote
Then we return an insurance risk of <riskResult>
|lowerLimit|upperLimit|riskResult|
|18 | 29 | low |
|30 | 54 | med |
|55 | 65 | high |
Scenario Outline
What if they smoke?
What if they drink alcohol?
What if they have known health issues?
What about people under 18 and over 70?
Questions Raised
In order not to insurance under & over aged
customers
as an insurance company,
I want to raise an exception
Additional Stories
We have learnt about our domain
The customer worries about age limits more
than anything else
We also know that other items are upcoming
but …… we don’t need to develop them until
we have that story!
What we have learnt
Having conversations
Is more important than

capturing conversations
Is more important than

automating conversations
www.slideshare.net/lunivore/behavior-­‐driven-­‐development-­‐11754474	
  
Liz	
  Keogh	
  @lunivore
describe(“Customer is between 18 & 29”, function() {	
  
it( “will return an insurance risk of low”, function() {	
  
var customer = new customerBuilder().withAge(24).build(); 	
  
expect(riskService.generateRiskRating(customer))

.toBe(“low”);	
  
}) 	
  
})	
  
describe(“Customer is between 30 & 54”, function() {	
  
it( “will return an insurance risk of med”, function() {	
  
var customer = new customerBuilder().withAge(37).build();
expect(riskService.generateRiskRating(customer))

.toBe(“med”);	
  
}) 	
  
})
Scenario to TestBox
BDD & TDD
From	
  Growing	
  Object-­‐Oriented	
  Software	
  by	
  Nat	
  Pryce	
  and	
  Steve	
  Freeman
TestBox is a next generation testing framework for ColdFusion that is based
on BDD (Behavior Driven Development) for providing a clean obvious
syntax for writing tests. It contains not only a testing framework, runner,
assertions and expectations library but also integrates with MockBox for
mocking and stubbing. It also supports xUnit style of testing and MXUnit
compatibilities.
What you get!
Test Harness
Test Bundle CFC
• No matter what style, you start with a test
bundle CFC
• Inherits from testbox.system.BaseSpec or not!

• URL runner caveat
• Get’s lots of methods and properties for testing
• TestBox will then execute all tests within 1 or
more bundles
Running your bundles
• Execute bundle (if using inheritance) via the URL
– http://mysite/test/bundle.cfc?method=runRemote
• Using the TestBox Class: testbox.system.TestBox
– Bundle(s) Runner
– Directory Runner
– SOAP Runner
– HTTP/REST Runner
– ANT Runner
– Custom Runners
• What’s the output? We call this reporters
Reporters
• ANTJunit : A specific variant of JUnit XML that works with the ANT junitreport task
• Codexwiki : Produces MediaWiki syntax for usage in Codex Wiki
• Console : Sends report to console
• Doc : Builds semantic HTML to produce nice documentation
• Dot : Builds an awesome dot report
• JSON : Builds a report into JSON
• JUnit : Builds a JUnit compliant report
• Raw : Returns the raw structure representation of the testing results
• Simple : A basic HTML reporter
• Text : Back to the 80's with an awesome text report
• XML : Builds yet another XML testing report
• Tap : A test anything protocol reporter
• Min : A minimalistic view of your test reports
ITB2015 - Behavior Driven Development, Automation and Continuous Integration
Let’s walk through an example
• The life insurance example
• We’ll use a BDD Spec to tell us when we’re done
• We’ll use TDD to drive the design of our code
What the future holds!
• Grunt JS Tasks
• NodeJS Runners and Watchers
• Sublime Runner
• More Reporters
• More focus on automation
• Gherkins support

More Related Content

PDF
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
PPTX
Getting out of the monolith hell
PPTX
ITB2015 - NoSQL For You And Me
PDF
ITB2015 - Winning with Vagrant, Puppet and Chef
PDF
ITB2015 - Monitoring and Tracking Your Web Applications
PDF
ITB2015 - ColdBox 4 MVC Modular Architecture
PPTX
ITB2015 - Go Commando with CommandBox CLI
PDF
ITB2015 - Customizing ContentBox with Themes, Widgets, and Modules, Oh My!
Emily Bache - Readable, Executable Requirements: Hands-On - EuroSTAR 2013
Getting out of the monolith hell
ITB2015 - NoSQL For You And Me
ITB2015 - Winning with Vagrant, Puppet and Chef
ITB2015 - Monitoring and Tracking Your Web Applications
ITB2015 - ColdBox 4 MVC Modular Architecture
ITB2015 - Go Commando with CommandBox CLI
ITB2015 - Customizing ContentBox with Themes, Widgets, and Modules, Oh My!

Viewers also liked (15)

PDF
ORM Pink Unicorns
PDF
ITB2015 - Crash Course in Ionic + AngularJS
PDF
ITB2015 - Real Life ContentBox Modular CMS
PPTX
Story Book
PPTX
話題呼
PDF
CBDW2014 - Railo 5.0 and Beyond
PPTX
Mood boards
PDF
Where to find $59 Trillion: A Map for Nonprofits
PPT
Проблеми комп’ютероманії
PDF
CBDW2014 - ColdBox 4 Modules
PDF
0 6 método de los desplazamientos
PPTX
ARS MARKETING _ PROFILE
PPTX
Costumes
PPTX
과제
PPTX
Storyboard final
ORM Pink Unicorns
ITB2015 - Crash Course in Ionic + AngularJS
ITB2015 - Real Life ContentBox Modular CMS
Story Book
話題呼
CBDW2014 - Railo 5.0 and Beyond
Mood boards
Where to find $59 Trillion: A Map for Nonprofits
Проблеми комп’ютероманії
CBDW2014 - ColdBox 4 Modules
0 6 método de los desplazamientos
ARS MARKETING _ PROFILE
Costumes
과제
Storyboard final
Ad

Similar to ITB2015 - Behavior Driven Development, Automation and Continuous Integration (20)

PDF
CBDW2014 - Behavior Driven Development with TestBox
PDF
Test box bdd
PDF
Evolve your coding with some BDD
PPTX
Topic tdd-and-bdd b4usolution
PDF
How BDD enables True CI/CD
PPTX
Making the Move to Behavior Driven Development
PPTX
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
PDF
ITB2017 - Intro to Behavior Driven Development
PDF
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
PPT
BDD communication bridges - Expedia TED talk
PPTX
Gateway to Agile: XP and BDD
PDF
BDD in Action – principles, practices and real-world application
PDF
Whole team approach to agile testing bdd can help better pune 15th meetup
PPTX
Test-driven development & Behavior-driven development basics
PDF
Behavior Driven Development—A Guide to Agile Practices
PDF
I am afraid of no test! The power of BDD
PDF
Introduction to TDD and BDD
PDF
TDD and BDD and ATDD
PDF
Expo qa from user stories to automated acceptance tests with bdd
PPTX
Behavior Driven Development
CBDW2014 - Behavior Driven Development with TestBox
Test box bdd
Evolve your coding with some BDD
Topic tdd-and-bdd b4usolution
How BDD enables True CI/CD
Making the Move to Behavior Driven Development
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
ITB2017 - Intro to Behavior Driven Development
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
BDD communication bridges - Expedia TED talk
Gateway to Agile: XP and BDD
BDD in Action – principles, practices and real-world application
Whole team approach to agile testing bdd can help better pune 15th meetup
Test-driven development & Behavior-driven development basics
Behavior Driven Development—A Guide to Agile Practices
I am afraid of no test! The power of BDD
Introduction to TDD and BDD
TDD and BDD and ATDD
Expo qa from user stories to automated acceptance tests with bdd
Behavior Driven Development
Ad

More from Ortus Solutions, Corp (20)

PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
PDF
June Webinar: BoxLang-Dynamic-AWS-Lambda
PDF
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
PDF
What's-New-with-BoxLang-Brad Wood.pptx.pdf
PDF
Getting Started with BoxLang - CFCamp 2025.pdf
PDF
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
PDF
What's New with BoxLang Led by Brad Wood.pdf
PDF
Vector Databases and the BoxLangCFML Developer.pdf
PDF
Using cbSSO in a ColdBox App Led by Jacob Beers.pdf
PDF
Use JSON to Slash Your Database Performance.pdf
PDF
Portable CI wGitLab and Github led by Gavin Pickin.pdf
PDF
Tame the Mesh An intro to cross-platform tracing and troubleshooting.pdf
PDF
Supercharging CommandBox with Let's Encrypt.pdf
PDF
Spice up your site with cool animations using GSAP..pdf
PDF
Passkeys and cbSecurity Led by Eric Peterson.pdf
PDF
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
PDF
Integrating the OpenAI API in Your Coldfusion Apps.pdf
PDF
Hidden Gems in FusionReactor for BoxLang, ACF, and Lucee Users.pdf
PDF
Geting-started with BoxLang Led By Raymon Camden.pdf
PDF
From Zero to CRUD with ORM - Led by Annette Liskey.pdf
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
June Webinar: BoxLang-Dynamic-AWS-Lambda
BoxLang-Dynamic-AWS-Lambda by Luis Majano.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Getting Started with BoxLang - CFCamp 2025.pdf
CFCamp2025 - Keynote Day 1 led by Luis Majano.pdf
What's New with BoxLang Led by Brad Wood.pdf
Vector Databases and the BoxLangCFML Developer.pdf
Using cbSSO in a ColdBox App Led by Jacob Beers.pdf
Use JSON to Slash Your Database Performance.pdf
Portable CI wGitLab and Github led by Gavin Pickin.pdf
Tame the Mesh An intro to cross-platform tracing and troubleshooting.pdf
Supercharging CommandBox with Let's Encrypt.pdf
Spice up your site with cool animations using GSAP..pdf
Passkeys and cbSecurity Led by Eric Peterson.pdf
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Integrating the OpenAI API in Your Coldfusion Apps.pdf
Hidden Gems in FusionReactor for BoxLang, ACF, and Lucee Users.pdf
Geting-started with BoxLang Led By Raymon Camden.pdf
From Zero to CRUD with ORM - Led by Annette Liskey.pdf

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Approach and Philosophy of On baking technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
Teaching material agriculture food technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Modernizing your data center with Dell and AMD
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Approach and Philosophy of On baking technology
Machine learning based COVID-19 study performance prediction
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
NewMind AI Monthly Chronicles - July 2025
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Teaching material agriculture food technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Understanding_Digital_Forensics_Presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Modernizing your data center with Dell and AMD
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf

ITB2015 - Behavior Driven Development, Automation and Continuous Integration

  • 1. Intro  to  TDD  &  BDD
 Test Driven Development 
 & Behaviour Driven Development Kev McCabe In to The Box 2015 Sunday, 19 April 15
  • 2. Who am I? • Kev McCabe AKA @bigmadkev • Freelance Code Smith 
 & Agile Coach • Developer for over 18 years • Worked in TV Broadcast, Healthcare, Travel & Finance • Adobe Community Professional
  • 3. Agenda • Types of testing • Why Test • TDD Intro • BDD Intro • TestBox BDD
  • 4. Types of Testing GUI Integration Unit Tests Exploratory testing
  • 5. Real World Testing Pyramid GUI Integration Exploratory testing Unit TestsManual Testing
  • 6. Bugs cost money ^ Kaner,Cem; JamesBach, Bret Pettichord (2001). Lessons Learned inSoftwareTesting: A Context-Driven Approach.Wiley. p. 4. ISBN 0-471-08112-4.
  • 8. What is TDD Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards
  • 9. What is TDD What it is • A tool to drive design • Developer focused • Works with BDD • Non-intuitive but powerful tool What it is not • About testing • For the faint hearted • A silver bullet • Easy
  • 10. TDD Process From  Growing  Object-­‐Oriented  Software  by  Nat  Pryce  and  Steve  Freeman
  • 11. What is BDD In software engineering, behavior-driven development (BDD) is a software development process that emerged from test-driven development (TDD).Behavior- driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software developers and business analysts with shared tools and a shared process to collaborate on software development, with the aim of delivering “software that matters”
  • 12. What is BDD • Dan North - http://dannorth.net/introducing-bdd • Ubiquitous language – existing or being everywhere at the same time : constantly • Promotes communication & collaboration between – Developers + business analysts + stakeholders • Focuses on stories or requirements rather than on functions • Focuses on what a system should do and not on how it should be implemented – Better readability and visibility – Verify that software works but also that it meets customer expectations
  • 15. As an Insurance Company, I want to generate life insurance risk so that we don’t lose money Example 3 Amigos Session
  • 16. In order to not lose money as an insurance company, I want to generate life insurance risk Example 3 Amigos Session
  • 17. Scenario One Given a customer When they request a quote Then we return an insurance risk
  • 19. Scenario One Given a customer under 30 years When they request a life insurance quote Then we return an insurance risk of low
  • 20. Given a customer under 55 years When they request a life insurance quote Then we return an insurance risk of med Scenario Two
  • 21. Given a customer over 55 years When they request a life insurance quote Then we return an insurance risk of high Scenario Three
  • 22. Given a customer between 
 <lowerLimit> & <upperLimit> When they request a life insurance quote Then we return an insurance risk of <riskResult> |lowerLimit|upperLimit|riskResult| |18 | 29 | low | |30 | 54 | med | |55 | 65 | high | Scenario Outline
  • 23. What if they smoke? What if they drink alcohol? What if they have known health issues? What about people under 18 and over 70? Questions Raised
  • 24. In order not to insurance under & over aged customers as an insurance company, I want to raise an exception Additional Stories
  • 25. We have learnt about our domain The customer worries about age limits more than anything else We also know that other items are upcoming but …… we don’t need to develop them until we have that story! What we have learnt
  • 26. Having conversations Is more important than
 capturing conversations Is more important than
 automating conversations www.slideshare.net/lunivore/behavior-­‐driven-­‐development-­‐11754474   Liz  Keogh  @lunivore
  • 27. describe(“Customer is between 18 & 29”, function() {   it( “will return an insurance risk of low”, function() {   var customer = new customerBuilder().withAge(24).build();   expect(riskService.generateRiskRating(customer))
 .toBe(“low”);   })   })   describe(“Customer is between 30 & 54”, function() {   it( “will return an insurance risk of med”, function() {   var customer = new customerBuilder().withAge(37).build(); expect(riskService.generateRiskRating(customer))
 .toBe(“med”);   })   }) Scenario to TestBox
  • 28. BDD & TDD From  Growing  Object-­‐Oriented  Software  by  Nat  Pryce  and  Steve  Freeman
  • 29. TestBox is a next generation testing framework for ColdFusion that is based on BDD (Behavior Driven Development) for providing a clean obvious syntax for writing tests. It contains not only a testing framework, runner, assertions and expectations library but also integrates with MockBox for mocking and stubbing. It also supports xUnit style of testing and MXUnit compatibilities.
  • 32. Test Bundle CFC • No matter what style, you start with a test bundle CFC • Inherits from testbox.system.BaseSpec or not!
 • URL runner caveat • Get’s lots of methods and properties for testing • TestBox will then execute all tests within 1 or more bundles
  • 33. Running your bundles • Execute bundle (if using inheritance) via the URL – http://mysite/test/bundle.cfc?method=runRemote • Using the TestBox Class: testbox.system.TestBox – Bundle(s) Runner – Directory Runner – SOAP Runner – HTTP/REST Runner – ANT Runner – Custom Runners • What’s the output? We call this reporters
  • 34. Reporters • ANTJunit : A specific variant of JUnit XML that works with the ANT junitreport task • Codexwiki : Produces MediaWiki syntax for usage in Codex Wiki • Console : Sends report to console • Doc : Builds semantic HTML to produce nice documentation • Dot : Builds an awesome dot report • JSON : Builds a report into JSON • JUnit : Builds a JUnit compliant report • Raw : Returns the raw structure representation of the testing results • Simple : A basic HTML reporter • Text : Back to the 80's with an awesome text report • XML : Builds yet another XML testing report • Tap : A test anything protocol reporter • Min : A minimalistic view of your test reports
  • 36. Let’s walk through an example • The life insurance example • We’ll use a BDD Spec to tell us when we’re done • We’ll use TDD to drive the design of our code
  • 37. What the future holds! • Grunt JS Tasks • NodeJS Runners and Watchers • Sublime Runner • More Reporters • More focus on automation • Gherkins support