SlideShare a Scribd company logo
Behavior Driven DevelopmentSDXP/SDRuby10,000 Foot Overview
Presentation NotesDon’t bother to pound this into your laptopsThe whole thing is on:http://calicowebdev.com/tblogThere are some of my older blog posts about rSpec on:http://calicowebdev.com/blog
Who The Hell Am I?I’d be asking the same questionSince you asked (or not), Steve Ross (@cwd1)Calico Web Development, I build Web apps using primarily Ruby, rSpec, Cucumber and a bunch of other keen Ruby technologies like … um … Rails, Haml, SassOSS for last 10 years. Ruby/Rails since 2005Still trying to get it right … or better
Not Me… But when I’m not programming, this would be a good place to be, right?
Yikes!I have way more to talk about than I have time to talk.Big surprise.
Behavior Driven DevelopmentBDD is a way of expressing a set of expected results – i.e., tests.That is as opposed to TDD (test, blah) where you express what you think happened and check to see that it did.
Let’s See Some Side By SideBe patient. We’ll get to the real code.
Tools I UseRubyrSpec / rspec-railsCucumberFakerFixjourAgain, all this stuff is on:http://calicowebdev.com/tblog
Behavior vs. Test-Driven DevelopmentTDD Way def test_foo_is_seven   assert_equal(7, @foo) endBDD Waydescribe @foo do   it "should be seven" do     @foo.should == 7   end end
TDD vs BDD (Gratuitous Picture)TDD: assert(true, @surfers.last.hit?)BDD: @surfers.last.shouldbe_hit
The Premise:Readability of specs is better than “tests”Writability of specs is more naturalIt’s more likely that you will spec first
The FlowMy personal work habitsBounce around between Cucumber and rSpecCreate failing Scenario/Spec, then code to fixBuild coverage and edge case handling as I canTry not to be too obsessive :)
Cucumber: In One SentenceStory-based description of behaviorsDivides specification into Feature > ScenarioTests from way outside, ignoring internalsNot as focused as unit/functional testsEasier to miss edge casesSlowerKiller for covering full stacks like Rails
I Lied. Another SentenceFeature: Stopping a Car    In order to stop my car when I need to    As a driver    I want the brakes always to bring the car to a halt    Scenario: Stopping under normal circumstances      Given The ignition is on      And The car is in motion      When I step on the brake      Then I should stop    Scenario: Stopping when the accelerator is also depressed      Given The ignition is on      And The accelerator is also depressed      When I step on the brake      Then I should stop    Scenario: Stopping when the accelerator is stuck      Given The ignition is on      And The accelerator is stuck      When I step on the brake      Then I should stop
The Obligatory Rails BlogDeveloping from the outside inFirst do a bit of plumbingNext write featuresCode to make them passDrill down to specs where necessaryEventually, you want good coverage both at acceptance (Cuke) and spec level

More Related Content

PDF
The Agile Alibi (Pavlo Baron)
PDF
The Front End Testing Frontier - RubyConf 2010
PPTX
Spark View Engine Intro
PDF
Themes and Theme Frameworks - WordCamp Fayetteville 2013
PDF
infoShare 2013: Adam Bien - Java EE - And The Bloat Is Gone [EN]
PDF
Testbash Philly: A Mob Testing Experience
PDF
Tampere Testing Days: Exploratory Testing an API
PPT
Cis powerpoint
The Agile Alibi (Pavlo Baron)
The Front End Testing Frontier - RubyConf 2010
Spark View Engine Intro
Themes and Theme Frameworks - WordCamp Fayetteville 2013
infoShare 2013: Adam Bien - Java EE - And The Bloat Is Gone [EN]
Testbash Philly: A Mob Testing Experience
Tampere Testing Days: Exploratory Testing an API
Cis powerpoint

What's hot (9)

PPTX
Wp snapper review
PDF
PPTX
Aw galleries!
PDF
Multi Modal Voice Development with Amazon Alexa
PDF
Symfony Admin Generator
PPTX
JavaScript Debugging Tips and Tricks
PDF
AgileTD: Learning through osmosis
PDF
0514 matthew 57 blessed are the merciful power point church sermon
PDF
AgileTD: Mob testing Training Day
Wp snapper review
Aw galleries!
Multi Modal Voice Development with Amazon Alexa
Symfony Admin Generator
JavaScript Debugging Tips and Tricks
AgileTD: Learning through osmosis
0514 matthew 57 blessed are the merciful power point church sermon
AgileTD: Mob testing Training Day
Ad

Similar to SD Ruby BDD Talk (20)

PPT
Behavior Driven Development with Rails
PDF
Rspec and Capybara Intro Tutorial at RailsConf 2013
PDF
How to implement ruby on rails testing practices to build a successful web ap...
PPTX
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
PPTX
Specifications test automation pyramid public
PDF
Rethinking Testing
PDF
Basic RSpec 2
PDF
PPTX
TDD with RSpec
PDF
WTF is TDD
PDF
BDD style Unit Testing
PPTX
Rails automatic test driven development
PPTX
RSpec: What, How and Why
KEY
Testing Has Many Purposes
PDF
2011-02-03 LA RubyConf Rails3 TDD Workshop
PDF
PPTX
An Introduction To Software Development - Test Driven Development, Part 1
PPTX
TDD & BDD
Behavior Driven Development with Rails
Rspec and Capybara Intro Tutorial at RailsConf 2013
How to implement ruby on rails testing practices to build a successful web ap...
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Specifications test automation pyramid public
Rethinking Testing
Basic RSpec 2
TDD with RSpec
WTF is TDD
BDD style Unit Testing
Rails automatic test driven development
RSpec: What, How and Why
Testing Has Many Purposes
2011-02-03 LA RubyConf Rails3 TDD Workshop
An Introduction To Software Development - Test Driven Development, Part 1
TDD & BDD
Ad

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Building Integrated photovoltaic BIPV_UPV.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
sap open course for s4hana steps from ECC to s4
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectroscopy.pptx food analysis technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The AUB Centre for AI in Media Proposal.docx

SD Ruby BDD Talk

  • 2. Presentation NotesDon’t bother to pound this into your laptopsThe whole thing is on:http://calicowebdev.com/tblogThere are some of my older blog posts about rSpec on:http://calicowebdev.com/blog
  • 3. Who The Hell Am I?I’d be asking the same questionSince you asked (or not), Steve Ross (@cwd1)Calico Web Development, I build Web apps using primarily Ruby, rSpec, Cucumber and a bunch of other keen Ruby technologies like … um … Rails, Haml, SassOSS for last 10 years. Ruby/Rails since 2005Still trying to get it right … or better
  • 4. Not Me… But when I’m not programming, this would be a good place to be, right?
  • 5. Yikes!I have way more to talk about than I have time to talk.Big surprise.
  • 6. Behavior Driven DevelopmentBDD is a way of expressing a set of expected results – i.e., tests.That is as opposed to TDD (test, blah) where you express what you think happened and check to see that it did.
  • 7. Let’s See Some Side By SideBe patient. We’ll get to the real code.
  • 8. Tools I UseRubyrSpec / rspec-railsCucumberFakerFixjourAgain, all this stuff is on:http://calicowebdev.com/tblog
  • 9. Behavior vs. Test-Driven DevelopmentTDD Way def test_foo_is_seven assert_equal(7, @foo) endBDD Waydescribe @foo do it "should be seven" do @foo.should == 7 end end
  • 10. TDD vs BDD (Gratuitous Picture)TDD: assert(true, @surfers.last.hit?)BDD: @surfers.last.shouldbe_hit
  • 11. The Premise:Readability of specs is better than “tests”Writability of specs is more naturalIt’s more likely that you will spec first
  • 12. The FlowMy personal work habitsBounce around between Cucumber and rSpecCreate failing Scenario/Spec, then code to fixBuild coverage and edge case handling as I canTry not to be too obsessive :)
  • 13. Cucumber: In One SentenceStory-based description of behaviorsDivides specification into Feature > ScenarioTests from way outside, ignoring internalsNot as focused as unit/functional testsEasier to miss edge casesSlowerKiller for covering full stacks like Rails
  • 14. I Lied. Another SentenceFeature: Stopping a Car In order to stop my car when I need to As a driver I want the brakes always to bring the car to a halt Scenario: Stopping under normal circumstances Given The ignition is on And The car is in motion When I step on the brake Then I should stop Scenario: Stopping when the accelerator is also depressed Given The ignition is on And The accelerator is also depressed When I step on the brake Then I should stop Scenario: Stopping when the accelerator is stuck Given The ignition is on And The accelerator is stuck When I step on the brake Then I should stop
  • 15. The Obligatory Rails BlogDeveloping from the outside inFirst do a bit of plumbingNext write featuresCode to make them passDrill down to specs where necessaryEventually, you want good coverage both at acceptance (Cuke) and spec level