SlideShare a Scribd company logo
1 of 145
Download to read offline
Behaviour
    Driven
Infrastructure
   Lindsay Holmwood
DevOps
Behaviour
  Driven
Development
Behaviour
    Driven
Infrastructure?
What is a
behavioural test?
origins
Test Driven Development
write test
write test
             run test
write test
             run test


              test fails
write test
              run test


                test fails

    make test pass
write test
                run test

refactor
                  test fails

      make test pass
unit tests
input/output
     of

 functions
result = bar(foo)
assert(result, true)
xUnit
Behavior Driven Development




a reaction to test focus
testing the
flow of data
  in a system
test a
user can
perform a
task
make a donation
search for product
checkout cart
verifying a
  business’s
  functional
requirements
   are met
underlying
implementation is
    irrelevant
   to the business
Business: “assert(bar(foo),true)?”
Tech: “Yes”
Business: “Great”
Business: “assert(bar(foo),true)?”
Tech: “Yes”
Business: “Great”
Business: “Can I search for things?”
Tech: “Yes”
Business: “Great”
function
is important
implementation
     is not
verifying a
  business’s
  functional
requirements
   are met
integration tests
acceptance tests
“outside-in tests”
executable specification
written in
spoken language
so the business
understands what it is
     paying for
Enough business
touchy-feely mumbo
      jumbo!
I thought this was a
  Behaviour
    Driven
Infrastructure
       talk?
I thought this was a
  Behaviour
    Driven
Infrastructure
       talk?
Infrastructure as code
“The ‘Infrastructure’ is an
application, a long running
process with inputs, outputs
and state.”
                - Andrew Schafer, 2009
                          http://bit.ly/he3HBt
an abstraction
infrastructure
     is the
 application
daemons
  are the
libraries
configuration management
          is the
 programming language
infrastructure
      is
built with code
code without tests
        is
      bad
code without tests

     evil
        is
Why?
You can’t verify that
your system works.
Behaviour
    Driven
Infrastructure
Taking BDD
principals &
   tools
Adapting them to

infrastructure
 development
Show me the
  tools!
Cucumber
Executable format for
software specifications
Tool to execute that
   specification
Terminology
feature
            is a
module of common functionality
Feature: Google search
  To increase her knowledge
  A user
  Needs a search interface
  To discover information
feature
 has many
scenarios
Feature: Google search
  To increase her knowledge
  A user
  Needs a search interface
  To discover information

  Scenario: Home page
    When I visit "http://google.com.au/"
    And I fill in "q" with "great balls of fire"
    Then I should see "great balls of fire"
scenario
has many
 steps
Given
When
Then
And*
steps
  are like
unit tests
they map
      to
blocks of code
Feature: Google search
  To increase her knowledge
  A user
  Needs a search interface
  To discover information

  Scenario: Home page
    When I visit "http://google.com.au/"
    And I fill in "q" with "great balls of fire"
    Then I should see "great balls of fire"
When /^I visit "([^"]*)"$/ do |location|
  # code
end

When /^I fill in "([^"]*)" with "([^"]*)"$/ do |input, value|
  # code
end

Then /^I should see "([^"]*)"$/ do |string|
  # code
end
When /^I visit "([^"]*)"$/ do |location|
  visit(location)
end

When /^I fill in "([^"]*)" with "([^"]*)"$/ do |input, value|
  fill_in(input, :with => value)
end

Then /^I should see "([^"]*)"$/ do |string|
  response.body.should match(string)
end
blocks of code
    are like
  unit tests
∴ scenario
      is a
serial execution
  of unit tests
Installing
$ apt-get install rubygems
$ gem install cucumber
Using
$ apt-get install rubygems
$ gem install cucumber
$   apt-get install rubygems
$   gem install cucumber
$   mkdir -p project/features/steps
$   cd project
Testing Workflow
write test
write test
             run test
write test
             run test


              test fails
write test
              run test


                test fails

    make test pass
write test
                run test

refactor
                  test fails

      make test pass
$   apt-get install rubygems
$   gem install cucumber
$   mkdir -p project/features/steps
$   cd project
$   vim features/site.feature
Feature: Google search
  To increase her knowledge
  A user
  Needs a search interface
  To discover information

  Scenario: Home page
    When I visit "http://google.com.au/"
    And I fill in "q" with "great balls of fire"
    Then I should see "great balls of fire"
$   apt-get install rubygems
$   gem install cucumber
$   mkdir -p project/features/steps
$   cd project
$   vim features/site.feature
$   cucumber features/site.feature
$   vim features/steps/site_steps.rb
$   apt-get install rubygems
$   gem install cucumber
$   mkdir -p project/features/steps
$   cd project
$   vim features/site.feature
$   cucumber features/site.feature
$   vim features/steps/site_steps.rb
$   cucumber features/site.feature
Implications
Continuous
Integration
Test server builds
Execute tests
  on commit
to config management
What environments are
 the tests run against?
UAT?
  Staging?
Production?
Destructive tests?
Fixtures
Setup / Teardown
     Pattern
A/B testing
Migration to
config management
Continuous Integration
          &
 Monitoring Systems
build    deploy


notify    test
build    deploy


notify    test
notify   test
We’ve been asking the
 wrong questions
ping
connect
is the host up?
is the service available?
n etwork s  tack up
          other w is e broken
      but


     is the host up?
is the service available?
misconfiguration, bugs trig
                           gere d
     by user data, hacke d
Why should I
  care?
“Nagios checks
already do this!”
Cucumber
 provides a framework
to phrase questions
Given
When
Then
Lowers the
   barrier of entry to
writing good checks
Caveat:
You need a firm
grasp of language
Feature: Candy Store
  Wooooooooo!

  Scenario: Lollipops
    When I fly to the moon
    Then I should see monkeys
Feature: Candy Store
  Wooooooooo!

  Scenario: Lollipops
    When I fly to the moon
    Then I should see monkeys




           o mpletely vali d,
         c
         co mpletely useless
Cucumber
   provides a common
  specification format
dev & ops can share
Cucumber
    provides a common
  specification format
IT & business can share
Duplication of tests
Development
Production
Cucumber features
are librarised tests
Same specification
Different implementation
Where to
from here?
Write more code.
Patterns.
Expand the library
    of tests.
Explain to your friends,
colleagues, family, pets
      these ideas.
Discuss!
 Thank you.
Credits
http://www.flickr.com/photos/51746218@N03/5077975818/
http://www.flickr.com/photos/abrinsky/4981594203/
http://www.flickr.com/photos/andresrueda/3020304543/
http://www.flickr.com/photos/communityfriend/2342578485/
http://www.flickr.com/photos/damienroue/2775342201/
http://www.flickr.com/photos/elsie/3917813380/
http://www.flickr.com/photos/hugo90/5343453489/
http://www.flickr.com/photos/iamphejom/4930805430/
http://www.flickr.com/photos/jiuck/5060618037/
http://www.flickr.com/photos/kusamakura/2435343128/
http://www.flickr.com/photos/laurelfan/100700370/
http://www.flickr.com/photos/littledebbie11/3208631777/
http://www.flickr.com/photos/master-blitzy/1192778834/
http://www.flickr.com/photos/nasacommons/4858567480/
http://www.flickr.com/photos/nhankamer/4703022414/
http://www.flickr.com/photos/normanlowery/4674154988/
http://www.flickr.com/photos/paul_lowry/2266388742/
http://www.flickr.com/photos/pinprick/467320431/
http://www.flickr.com/photos/superciliousness/91346618/
http://www.flickr.com/photos/xaviergp/4003730145/

More Related Content

What's hot

Selenium at STPCon - Dallas 2011
Selenium at STPCon - Dallas 2011Selenium at STPCon - Dallas 2011
Selenium at STPCon - Dallas 2011
hugs
 
Create ABS Project In Twenty Minutes
Create ABS Project In Twenty MinutesCreate ABS Project In Twenty Minutes
Create ABS Project In Twenty Minutes
BENOIS Jérôme
 
Best Practices for Front-End Django Developers
Best Practices for Front-End Django DevelopersBest Practices for Front-End Django Developers
Best Practices for Front-End Django Developers
Christine Cheung
 

What's hot (20)

Continuous Deployment at Scale, PHPConfAsia 2016
Continuous Deployment at Scale, PHPConfAsia 2016Continuous Deployment at Scale, PHPConfAsia 2016
Continuous Deployment at Scale, PHPConfAsia 2016
 
Test automation with Cucumber-JVM
Test automation with Cucumber-JVMTest automation with Cucumber-JVM
Test automation with Cucumber-JVM
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
Is your API misbehaving?(Keith-Casey)
Is your API misbehaving?(Keith-Casey)Is your API misbehaving?(Keith-Casey)
Is your API misbehaving?(Keith-Casey)
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
 
Acceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvmAcceptance Test-driven Development with Cucumber-jvm
Acceptance Test-driven Development with Cucumber-jvm
 
Selenium at STPCon - Dallas 2011
Selenium at STPCon - Dallas 2011Selenium at STPCon - Dallas 2011
Selenium at STPCon - Dallas 2011
 
Introduction to testing in Rails
Introduction to testing in RailsIntroduction to testing in Rails
Introduction to testing in Rails
 
Capybara testing
Capybara testingCapybara testing
Capybara testing
 
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
The Open-source Eclipse Plugin for Force.com Development, Summer ‘14
 
Create ABS Project In Twenty Minutes
Create ABS Project In Twenty MinutesCreate ABS Project In Twenty Minutes
Create ABS Project In Twenty Minutes
 
Reliable acceptance testing
Reliable acceptance testingReliable acceptance testing
Reliable acceptance testing
 
django Forms in a Web API World
django Forms in a Web API Worlddjango Forms in a Web API World
django Forms in a Web API World
 
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
DevOps叢林裡的小隊游擊戰術 (@ iThome DevOps 2015)
 
BDD testing with cucumber
BDD testing with cucumberBDD testing with cucumber
BDD testing with cucumber
 
Best Practices for Front-End Django Developers
Best Practices for Front-End Django DevelopersBest Practices for Front-End Django Developers
Best Practices for Front-End Django Developers
 
Automated UI test on mobile - with Cucumber/Calabash
Automated UI test on mobile - with Cucumber/CalabashAutomated UI test on mobile - with Cucumber/Calabash
Automated UI test on mobile - with Cucumber/Calabash
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for Beginners
 
An Introduction to Behaviour Driven Development with Cucumber Java
An Introduction to Behaviour Driven Development with Cucumber JavaAn Introduction to Behaviour Driven Development with Cucumber Java
An Introduction to Behaviour Driven Development with Cucumber Java
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 

Similar to Behaviour driven infrastructure

David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and RoadmapDavid Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
Day Software
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
Toru Furukawa
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
dimakovalenko
 
How Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build HerokuHow Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build Heroku
Craig Kerstiens
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
defrag2
 

Similar to Behaviour driven infrastructure (20)

Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right now
 
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and RoadmapDavid Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
 
How Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build HerokuHow Heroku uses Heroku to build Heroku
How Heroku uses Heroku to build Heroku
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
Engineering Velocity @indeed eng presented on Sept 24 2014 at Beyond Agile
Engineering Velocity @indeed eng presented on Sept 24 2014 at Beyond AgileEngineering Velocity @indeed eng presented on Sept 24 2014 at Beyond Agile
Engineering Velocity @indeed eng presented on Sept 24 2014 at Beyond Agile
 
Attacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryAttacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous Delivery
 
Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)
 
Pycon India 12
Pycon India 12Pycon India 12
Pycon India 12
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
 
Sexy Using Cucumber - BDD in your project
Sexy Using Cucumber - BDD in your projectSexy Using Cucumber - BDD in your project
Sexy Using Cucumber - BDD in your project
 

More from Lindsay Holmwood

Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with Ruby
Lindsay Holmwood
 

More from Lindsay Holmwood (12)

Escalating complexity: DevOps learnings from Air France 447
Escalating complexity: DevOps learnings from Air France 447Escalating complexity: DevOps learnings from Air France 447
Escalating complexity: DevOps learnings from Air France 447
 
AA261: DevOps lessons in collaborative maintenance
AA261: DevOps lessons in collaborative maintenanceAA261: DevOps lessons in collaborative maintenance
AA261: DevOps lessons in collaborative maintenance
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 
Load testing with Blitz
Load testing with BlitzLoad testing with Blitz
Load testing with Blitz
 
Latency: The Silent Monitoring System Killer
Latency: The Silent Monitoring System KillerLatency: The Silent Monitoring System Killer
Latency: The Silent Monitoring System Killer
 
Rump - making Puppetmaster-less Puppet meaty
Rump - making Puppetmaster-less Puppet meatyRump - making Puppetmaster-less Puppet meaty
Rump - making Puppetmaster-less Puppet meaty
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Behaviour Driven Monitoring with cucumber-nagios
Behaviour Driven Monitoring with cucumber-nagiosBehaviour Driven Monitoring with cucumber-nagios
Behaviour Driven Monitoring with cucumber-nagios
 
Flapjack: rethinking monitoring for the cloud
Flapjack: rethinking monitoring for the cloudFlapjack: rethinking monitoring for the cloud
Flapjack: rethinking monitoring for the cloud
 
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagiosMonitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
 
Your own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with RubyYour own (little) gem: building an online business with Ruby
Your own (little) gem: building an online business with Ruby
 
Deploying Merb
Deploying MerbDeploying Merb
Deploying Merb
 

Recently uploaded

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Behaviour driven infrastructure