SlideShare a Scribd company logo
Evolve your coding
with a little BDD
WHO AM I?
• Luis Majano
• Computer Engineer
• Imported from El Salvador
• CEO of Ortus Solutions
• Creator of all things Box
Why you don’t test
WhyTest
TDD
BDD
Getting jiggy with it
Where to start?
What to test?
What not to test?
WHY PEOPLE DON’T TEST
BIGGEST LIE IN SOFTWARE DEV
Don’t worry, we will
create the tests and
refactor it later!
Evolve your coding with some BDD
Cost To Fix Time detected
Requirements Design Building Testing Post-Release
Time
Introduced
Requirements 1x 3x 5-10x 10x 10-100x
Design --- 1x 10x 15x 25-100x
Building -- -- 1x 10x 10-25x
^ Kaner, Cem; James Bach, Bret Pettichord (2001). Lessons Learned in Software Testing: A Context-Driven Approach. Wiley. p. 4. ISBN 0-471-08112-4.
BUGS COST MONEY
MANUAL TESTING
What isT.D.D
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
T.D.D. Process
Write Test
Mock
Write CodeVerify
Refactor
T.D.D.
CFC
Validate()
Add()
List()
Save()
Test%
CFC%
testValidate()%
testAdd()%
testList()%
testSave()%
T.D.D. IS…
• Exercises your code
• Very Developer Focused
• Developer has immediate feedback
• Create tests before rather than after (yea right!)
• Express some behavior and ideas
• Creates some documentation
T.D.D. IS NOT…
• About verifying software requirements
• Easy
• Let’s be truthful,TDD can be a pain in the
buttocks!
• We start strong, but we finish weak, even if we
finish
Developer Test
Paralysis
What is B.D.D.?
In software engineering, behavior-driven development
(BDD) is a software development process based on
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"
B.D.D isT.D.D. Evolved
• 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
B.D.D. Process
Stories
Scenario
Specs
Implement
Behavior
Verify
Refactor
Questions Answered
Where%to%
start?%
Outside%/
>%In%
What%to%
test?%
User%
Stories%
What%Not%
to%test?%
Anything%
Else%
Story Framework
Story Scenario Spec
Stories to Scenarios
As an application user
I want to be welcomed with my name at login
in order to personalize my experience
Scenario: user login with valid credentials
Given a user “luis" with password "secret" exists
When I login as “luis" with "secret"
Then I should see the message "Welcome back luis!"
Stories to Scenarios
+Scenario 1: Account is in credit+
Given the account is in credit
And the card is valid
And the dispenser contains cash
When the customer requests cash
Then ensure the account is debited
And ensure cash is dispensed
And ensure the card is returned
Stories to Scenarios
Feature: Box Size
In order to know what size box I need
As a distribution manager
I want to know the volume of the box
Scenario: Get box volume
Given I have entered a width of 20
And a height of 30
And a depth of 40
When I run the calculation
Then the result should be 24000
Stories to Scenarios
Stories to Scenarios
Gherkins
Evolve your coding with some BDD
Story to Scenario to
TestBox
As an application user
I want to be welcomed with my name at login
in order to personalize my experience
Scenario: user login with valid credentials
Given a user “luis" with password "secret" exists
When I login as “luis" with "secret"
Then I should see the message "Welcome back luis!"
describe( “User login with valid credentials”, function(){
it( “should see a personalized message”, function(){
userService.login( “luis”, “secret” )
var event = execute(“user.home”)
expect( event.getValue( “welcome” ) ).toBe( “Welcome back luis!” )
})
})
Story to Scenario to
TestBox
As an application user
I want to be welcomed with my name at login
in order to personalize my experience
Scenario: user login with valid credentials
Given a user “luis" with password "secret" exists
When I login as “luis" with "secret"
Then I should see the message "Welcome back luis!"
scenario( “User login with valid credentials”, function(){
given( “A user Luis with password secret exists”, function(){
when( “I login as ‘luis’ and ‘secret’”, function(){
then( “I should see a message ‘Welcome back luis’”, function(){
expect( event.getValue( “welcome” ) ).toBe( “Welcome back luis!” )
});});
});});
Story to Scenario to
TestBox
feature( "Box Size", function(){
describe( "In order to know what size box I need
As a distribution manager
I want to know the volume of the box", function(){
scenario( "Get box volume", function(){
given( "I have entered a width of 20
And a height of 30
And a depth of 40", function(){
when( "I run the calculation", function(){
then( "the result should be 24000", function(){
expect( myObject.myFunction(20,30,40) ).toBe( 24000 );
});});});});}););
Story to Scenario to
TestBox
story("As a distribution manager, I want to know the volume of the box I
need", function() {
given("I have a width of 20
And a height of 30
And a depth of 40", function() {
when("I run the calculation", function() {
then("the result should be 24000", function() {
expect(myObject.myFunction(20,30,40)).toBe(24000);
});
});
});
});
• BDD & xUnit style testing
• MXUnit Compatible
• Life-Cycle methods
• MockBox Integration
• AsynchronousTesting
• ANT/Jenkins Integration
• Custom Reporters & Runners
• Dynamic Labels & Skipping
• Debug Output Streams
REQUIREMENTS
• ColdFusion 9.01+, Lucee 4+
• xUnit + MXUnit Compatibility
• ColdFusion 10+, Lucee 4+
• xUnit, MXUnit, BDD
INSTALLATION
• CommandBox
• box install testbox —saveDev
• box install testbox-be —saveDev
• Manual download and create mapping:
TESTING STYLES
xUnit
TDD
Unit Focused
Function Focused
Asserts
BDD
Test Scenarios
Spec Focused
Nested Scenarios
Expectations
MXUNIT COMPATIBLE
• Compatible with xUnit style by MXUnit
• Migrate existing tests toTestBox
• No BDD
• How do you migrate?







• If something is not working, report it: bugs@coldbox.org
What you get! API Docs
Core
Test Browser
Test Harness
Test Runner
Samples
Test Harness
Automated test
results!
xUnit/BDDTest
Bundles
Harness bootstrap
HTML Runner
ANT Runner
TEST BUNDLE CFC
• Inherits from testbox.system.BaseSpec





• TesBox will then execute all tests within 1 or more bundles
RUNNINGYOUR BUNDLES
• Execute bundle via the URL
• http://mysite/tests/bundle.cfc?method=runRemote
• SOAP Runner
• HTTP/REST Runner
• ANT Runner
• NodeJS Runner
• CommandBox Runner
• Custom Runner
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
TEST BUNDLE CFC
• run()
• Declare your scenario specs + suites
• Life-cycle methods
• beforeAll(), afterAll()
• Expectations Library: expect()
• Assertions Library: $assert
SUITES: DESCRIBE()YOURTESTS
• Suites begin with a describe() block
• title
• closure
• A suite is composed of specs or more suites
• Closures can contain
• Life-cycle methods
• More suites
• Specs
DESCRIBE() ALIASES
•story()
•feature()
•given()
•when()
•scenario()
feature( "Box Size", function(){
describe( "In order to know what size box I need
As a distribution manager
I want to know the volume of the box", function()
scenario( "Get box volume", function(){
given( "I have entered a width of 20
And a height of 30
And a depth of 40", function(){
when( "I run the calculation", function(){
then( "the result should be 24000", functi
expect( myObject.myFunction(20,30,40) ).to
});});});});}););
SPECS: IT()
• At least 2 args
• Title
• Closure
• Labels
• Skip
• Closure is where you:
• Code testing scenarios
• 1+ expectations or assertions
• Specs tested in order declared
IT() ALIASES
•it()
•then()
feature( "Box Size", function(){
describe( "In order to know what size box I need
As a distribution manager
I want to know the volume of the box", function(){
scenario( "Get box volume", function(){
given( "I have entered a width of 20
And a height of 30
And a depth of 40", function(){
when( "I run the calculation", function(){
then( "the result should be 24000", function(){
expect( myObject.myFunction(20,30,40) ).toBe( 24
});});});});}););
EXPECTATIONS
• Self-concatenated method calls that evaluate your SUT
• Start with a call to expect( actual )
• Concatenated with matcher methods
• Matchers also have negation (not) counterparts
NESTED SUITES
• Life-cycle methods bubble up
• Great for grouping and recursive scenarios
• Execute in descending order
EXPECTING EXCEPTIONS
• Verifies exceptions
• Pass a closure to expect() and use toThrow( type, regex )
• Match types and message+detail regex
AUTOMATION
Evolve your coding with some BDD
Evolve your coding with some BDD
Evolve your coding with some BDD
Evolve your coding with some BDD
Evolve your coding with some BDD
Lots of TestBox FreeTraining
www.ortussolutions.com/products/testbox


Free eBooks
Lots BDD Examples: ColdBox, Couchbase SDK,
TestBox
ProfessionalTraining
Thanks!
Q & A

More Related Content

What's hot (8)

PPT
J query presentation
akanksha17
 
KEY
iPhone project - Wireless networks seminar
Silvio Daminato
 
PDF
fuser interface-development-using-jquery
Kostas Mavridis
 
ZIP
Barcamp Auckland Rails3 presentation
Sociable
 
PDF
DEF CON 27 - ALVARO MUNOZ / OLEKSANDR MIROSH - sso wars the token menace
Felipe Prado
 
PPT
jQuery Objects
Steve Wells
 
PPTX
Real World MVC
James Johnson
 
PPTX
Stop (de)bugging me - ICON UK 2013
Mark Leusink
 
J query presentation
akanksha17
 
iPhone project - Wireless networks seminar
Silvio Daminato
 
fuser interface-development-using-jquery
Kostas Mavridis
 
Barcamp Auckland Rails3 presentation
Sociable
 
DEF CON 27 - ALVARO MUNOZ / OLEKSANDR MIROSH - sso wars the token menace
Felipe Prado
 
jQuery Objects
Steve Wells
 
Real World MVC
James Johnson
 
Stop (de)bugging me - ICON UK 2013
Mark Leusink
 

Viewers also liked (20)

PDF
Intro to RESTFul API's with ColdBox MVC
Ortus Solutions, Corp
 
PPTX
Q1 Evaluation
LucyAnne97
 
PPTX
Story book evaluation
Duncan Warren-Rix
 
PPTX
Fc, cp, dps
laurenjewell
 
PPTX
Ancillary task
LucyAnne97
 
PPTX
Michael jackson music vid
LucyAnne97
 
PPTX
El Greco
george fotos
 
PDF
0 6 método de los desplazamientos
Bryan Aucca
 
PPT
Administrative staff
dersonsaman
 
PPTX
Star wars return of the jedi
LucyAnne97
 
PPTX
REDES SOCIALES
Daniela Tapias
 
PPTX
Contexto histórico 1
Leonardo Melo
 
PPT
Breaking wifi-faster
kniouafakir
 
PPT
Office administrative assistant
dersonsaman
 
PPTX
ideological and material structure of Widowhood
Abhishek Sangavikar
 
PPT
forces
susantom
 
PPTX
Storyboard final
LucyAnne97
 
DOCX
Nimmy digital text book
nimmysajikumar
 
PPTX
Кожна дитина має право
Наталія Дорощук
 
PPTX
Pro forma
Duncan Warren-Rix
 
Intro to RESTFul API's with ColdBox MVC
Ortus Solutions, Corp
 
Q1 Evaluation
LucyAnne97
 
Story book evaluation
Duncan Warren-Rix
 
Fc, cp, dps
laurenjewell
 
Ancillary task
LucyAnne97
 
Michael jackson music vid
LucyAnne97
 
El Greco
george fotos
 
0 6 método de los desplazamientos
Bryan Aucca
 
Administrative staff
dersonsaman
 
Star wars return of the jedi
LucyAnne97
 
REDES SOCIALES
Daniela Tapias
 
Contexto histórico 1
Leonardo Melo
 
Breaking wifi-faster
kniouafakir
 
Office administrative assistant
dersonsaman
 
ideological and material structure of Widowhood
Abhishek Sangavikar
 
forces
susantom
 
Storyboard final
LucyAnne97
 
Nimmy digital text book
nimmysajikumar
 
Кожна дитина має право
Наталія Дорощук
 
Ad

Similar to Evolve your coding with some BDD (20)

PDF
CBDW2014 - Behavior Driven Development with TestBox
Ortus Solutions, Corp
 
PDF
ITB2017 - Intro to Behavior Driven Development
Ortus Solutions, Corp
 
PDF
Test box bdd
ColdFusionConference
 
PDF
Just Do It! ColdBox Integration Testing
Ortus Solutions, Corp
 
PDF
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Ortus Solutions, Corp
 
PDF
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
PDF
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Uma Ghotikar
 
PDF
I am afraid of no test! The power of BDD
Ortus Solutions, Corp
 
PDF
Intro to TDD & BDD
devObjective
 
PDF
ITB2015 - Behavior Driven Development, Automation and Continuous Integration
Ortus Solutions, Corp
 
PDF
2015 in tothebox-introtddbdd
ColdFusionConference
 
PDF
BDD Testing and Automating from the trenches - Presented at Into The Box June...
Gavin Pickin
 
PDF
ITB2016 -BDD testing and automation from the trenches
Ortus Solutions, Corp
 
PDF
Testing - How Vital and How Easy to use
Uma Ghotikar
 
PPTX
Test Driven Development - a Practitioner’s Perspective
Malinda Kapuruge
 
PPTX
Understanding TDD - theory, practice, techniques and tips.
Malinda Kapuruge
 
PPTX
Topic tdd-and-bdd b4usolution
Hoa Le
 
PPTX
Java Script Isn\'t a Toy Anymore
Alexis Williams
 
PDF
Intro to JavaScript Testing
Ran Mizrahi
 
PDF
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
atSistemas
 
CBDW2014 - Behavior Driven Development with TestBox
Ortus Solutions, Corp
 
ITB2017 - Intro to Behavior Driven Development
Ortus Solutions, Corp
 
Test box bdd
ColdFusionConference
 
Just Do It! ColdBox Integration Testing
Ortus Solutions, Corp
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Ortus Solutions, Corp
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Uma Ghotikar
 
I am afraid of no test! The power of BDD
Ortus Solutions, Corp
 
Intro to TDD & BDD
devObjective
 
ITB2015 - Behavior Driven Development, Automation and Continuous Integration
Ortus Solutions, Corp
 
2015 in tothebox-introtddbdd
ColdFusionConference
 
BDD Testing and Automating from the trenches - Presented at Into The Box June...
Gavin Pickin
 
ITB2016 -BDD testing and automation from the trenches
Ortus Solutions, Corp
 
Testing - How Vital and How Easy to use
Uma Ghotikar
 
Test Driven Development - a Practitioner’s Perspective
Malinda Kapuruge
 
Understanding TDD - theory, practice, techniques and tips.
Malinda Kapuruge
 
Topic tdd-and-bdd b4usolution
Hoa Le
 
Java Script Isn\'t a Toy Anymore
Alexis Williams
 
Intro to JavaScript Testing
Ran Mizrahi
 
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
atSistemas
 
Ad

More from Ortus Solutions, Corp (20)

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

Recently uploaded (20)

PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 

Evolve your coding with some BDD

  • 1. Evolve your coding with a little BDD
  • 2. WHO AM I? • Luis Majano • Computer Engineer • Imported from El Salvador • CEO of Ortus Solutions • Creator of all things Box
  • 3. Why you don’t test WhyTest TDD BDD Getting jiggy with it
  • 4. Where to start? What to test? What not to test?
  • 6. BIGGEST LIE IN SOFTWARE DEV Don’t worry, we will create the tests and refactor it later!
  • 8. Cost To Fix Time detected Requirements Design Building Testing Post-Release Time Introduced Requirements 1x 3x 5-10x 10x 10-100x Design --- 1x 10x 15x 25-100x Building -- -- 1x 10x 10-25x ^ Kaner, Cem; James Bach, Bret Pettichord (2001). Lessons Learned in Software Testing: A Context-Driven Approach. Wiley. p. 4. ISBN 0-471-08112-4. BUGS COST MONEY
  • 10. What isT.D.D 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
  • 13. T.D.D. IS… • Exercises your code • Very Developer Focused • Developer has immediate feedback • Create tests before rather than after (yea right!) • Express some behavior and ideas • Creates some documentation
  • 14. T.D.D. IS NOT… • About verifying software requirements • Easy • Let’s be truthful,TDD can be a pain in the buttocks! • We start strong, but we finish weak, even if we finish Developer Test Paralysis
  • 15. What is B.D.D.? In software engineering, behavior-driven development (BDD) is a software development process based on 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"
  • 16. B.D.D isT.D.D. Evolved • 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
  • 20. Stories to Scenarios As an application user I want to be welcomed with my name at login in order to personalize my experience Scenario: user login with valid credentials Given a user “luis" with password "secret" exists When I login as “luis" with "secret" Then I should see the message "Welcome back luis!"
  • 21. Stories to Scenarios +Scenario 1: Account is in credit+ Given the account is in credit And the card is valid And the dispenser contains cash When the customer requests cash Then ensure the account is debited And ensure cash is dispensed And ensure the card is returned
  • 22. Stories to Scenarios Feature: Box Size In order to know what size box I need As a distribution manager I want to know the volume of the box Scenario: Get box volume Given I have entered a width of 20 And a height of 30 And a depth of 40 When I run the calculation Then the result should be 24000
  • 27. Story to Scenario to TestBox As an application user I want to be welcomed with my name at login in order to personalize my experience Scenario: user login with valid credentials Given a user “luis" with password "secret" exists When I login as “luis" with "secret" Then I should see the message "Welcome back luis!" describe( “User login with valid credentials”, function(){ it( “should see a personalized message”, function(){ userService.login( “luis”, “secret” ) var event = execute(“user.home”) expect( event.getValue( “welcome” ) ).toBe( “Welcome back luis!” ) }) })
  • 28. Story to Scenario to TestBox As an application user I want to be welcomed with my name at login in order to personalize my experience Scenario: user login with valid credentials Given a user “luis" with password "secret" exists When I login as “luis" with "secret" Then I should see the message "Welcome back luis!" scenario( “User login with valid credentials”, function(){ given( “A user Luis with password secret exists”, function(){ when( “I login as ‘luis’ and ‘secret’”, function(){ then( “I should see a message ‘Welcome back luis’”, function(){ expect( event.getValue( “welcome” ) ).toBe( “Welcome back luis!” ) });}); });});
  • 29. Story to Scenario to TestBox feature( "Box Size", function(){ describe( "In order to know what size box I need As a distribution manager I want to know the volume of the box", function(){ scenario( "Get box volume", function(){ given( "I have entered a width of 20 And a height of 30 And a depth of 40", function(){ when( "I run the calculation", function(){ then( "the result should be 24000", function(){ expect( myObject.myFunction(20,30,40) ).toBe( 24000 ); });});});});}););
  • 30. Story to Scenario to TestBox story("As a distribution manager, I want to know the volume of the box I need", function() { given("I have a width of 20 And a height of 30 And a depth of 40", function() { when("I run the calculation", function() { then("the result should be 24000", function() { expect(myObject.myFunction(20,30,40)).toBe(24000); }); }); }); });
  • 31. • BDD & xUnit style testing • MXUnit Compatible • Life-Cycle methods • MockBox Integration • AsynchronousTesting • ANT/Jenkins Integration • Custom Reporters & Runners • Dynamic Labels & Skipping • Debug Output Streams
  • 32. REQUIREMENTS • ColdFusion 9.01+, Lucee 4+ • xUnit + MXUnit Compatibility • ColdFusion 10+, Lucee 4+ • xUnit, MXUnit, BDD
  • 33. INSTALLATION • CommandBox • box install testbox —saveDev • box install testbox-be —saveDev • Manual download and create mapping:
  • 34. TESTING STYLES xUnit TDD Unit Focused Function Focused Asserts BDD Test Scenarios Spec Focused Nested Scenarios Expectations
  • 35. MXUNIT COMPATIBLE • Compatible with xUnit style by MXUnit • Migrate existing tests toTestBox • No BDD • How do you migrate?
 
 
 
 • If something is not working, report it: [email protected]
  • 36. What you get! API Docs Core Test Browser Test Harness Test Runner Samples
  • 38. TEST BUNDLE CFC • Inherits from testbox.system.BaseSpec
 
 
 • TesBox will then execute all tests within 1 or more bundles
  • 39. RUNNINGYOUR BUNDLES • Execute bundle via the URL • http://mysite/tests/bundle.cfc?method=runRemote • SOAP Runner • HTTP/REST Runner • ANT Runner • NodeJS Runner • CommandBox Runner • Custom Runner
  • 40. 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
  • 41. TEST BUNDLE CFC • run() • Declare your scenario specs + suites • Life-cycle methods • beforeAll(), afterAll() • Expectations Library: expect() • Assertions Library: $assert
  • 42. SUITES: DESCRIBE()YOURTESTS • Suites begin with a describe() block • title • closure • A suite is composed of specs or more suites • Closures can contain • Life-cycle methods • More suites • Specs
  • 43. DESCRIBE() ALIASES •story() •feature() •given() •when() •scenario() feature( "Box Size", function(){ describe( "In order to know what size box I need As a distribution manager I want to know the volume of the box", function() scenario( "Get box volume", function(){ given( "I have entered a width of 20 And a height of 30 And a depth of 40", function(){ when( "I run the calculation", function(){ then( "the result should be 24000", functi expect( myObject.myFunction(20,30,40) ).to });});});});}););
  • 44. SPECS: IT() • At least 2 args • Title • Closure • Labels • Skip • Closure is where you: • Code testing scenarios • 1+ expectations or assertions • Specs tested in order declared
  • 45. IT() ALIASES •it() •then() feature( "Box Size", function(){ describe( "In order to know what size box I need As a distribution manager I want to know the volume of the box", function(){ scenario( "Get box volume", function(){ given( "I have entered a width of 20 And a height of 30 And a depth of 40", function(){ when( "I run the calculation", function(){ then( "the result should be 24000", function(){ expect( myObject.myFunction(20,30,40) ).toBe( 24 });});});});}););
  • 46. EXPECTATIONS • Self-concatenated method calls that evaluate your SUT • Start with a call to expect( actual ) • Concatenated with matcher methods • Matchers also have negation (not) counterparts
  • 47. NESTED SUITES • Life-cycle methods bubble up • Great for grouping and recursive scenarios • Execute in descending order
  • 48. EXPECTING EXCEPTIONS • Verifies exceptions • Pass a closure to expect() and use toThrow( type, regex ) • Match types and message+detail regex
  • 55. Lots of TestBox FreeTraining www.ortussolutions.com/products/testbox 
 Free eBooks Lots BDD Examples: ColdBox, Couchbase SDK, TestBox ProfessionalTraining