SlideShare a Scribd company logo
1 of 15
Behavior Driven DevelopmentSDXP/SDRuby 10,000 Foot Overview
Presentation Notes Don’t bother to pound this into your laptops The whole thing is on: http://calicowebdev.com/tblog There 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 question Since 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, Sass OSS for last 10 years. Ruby/Rails since 2005 Still 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 Development BDD 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 Side Be patient. We’ll get to the real code.
Tools I Use Ruby rSpec / rspec-rails Cucumber Faker Fixjour Again, all this stuff is on:http://calicowebdev.com/tblog
Behavior vs. Test-Driven Development TDD Way  def test_foo_is_seven    assert_equal(7, @foo)  end BDD Way describe @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 natural It’s more likely that you will spec first
The Flow My personal work habits Bounce around between Cucumber and rSpec Create failing Scenario/Spec, then code to fix Build coverage and edge case handling as I can Try not to be too obsessive :)
Cucumber: In One Sentence Story-based description of behaviors Divides specification into Feature > Scenario Tests from way outside, ignoring internals Not as focused as unit/functional tests Easier to miss edge cases Slower Killer for covering full stacks like Rails
I Lied. Another Sentence Feature: 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 Blog Developing from the outside in First do a bit of plumbing Next write features Code to make them pass Drill down to specs where necessary Eventually, you want good coverage both at acceptance (Cuke) and spec level

More Related Content

What's hot

Wp snapper review
Wp snapper reviewWp snapper review
Wp snapper reviewDilip Kumar
 
Multi Modal Voice Development with Amazon Alexa
Multi Modal Voice Development with Amazon AlexaMulti Modal Voice Development with Amazon Alexa
Multi Modal Voice Development with Amazon AlexaRalf Eggert
 
Symfony Admin Generator
Symfony Admin GeneratorSymfony Admin Generator
Symfony Admin Generatorguest839541
 
JavaScript Debugging Tips and Tricks
JavaScript Debugging Tips and TricksJavaScript Debugging Tips and Tricks
JavaScript Debugging Tips and TricksSunny Sharma
 
AgileTD: Learning through osmosis
AgileTD: Learning through osmosisAgileTD: Learning through osmosis
AgileTD: Learning through osmosisMaaret Pyhäjärvi
 
0514 matthew 57 blessed are the merciful power point church sermon
0514 matthew 57 blessed are the merciful power point church sermon0514 matthew 57 blessed are the merciful power point church sermon
0514 matthew 57 blessed are the merciful power point church sermonPowerPoint_Sermons
 
AgileTD: Mob testing Training Day
AgileTD: Mob testing Training DayAgileTD: Mob testing Training Day
AgileTD: Mob testing Training DayMaaret Pyhäjärvi
 

What's hot (9)

Wp snapper review
Wp snapper reviewWp snapper review
Wp snapper review
 
Merb Core
Merb CoreMerb Core
Merb Core
 
Aw galleries!
Aw galleries!Aw galleries!
Aw galleries!
 
Multi Modal Voice Development with Amazon Alexa
Multi Modal Voice Development with Amazon AlexaMulti Modal Voice Development with Amazon Alexa
Multi Modal Voice Development with Amazon Alexa
 
Symfony Admin Generator
Symfony Admin GeneratorSymfony Admin Generator
Symfony Admin Generator
 
JavaScript Debugging Tips and Tricks
JavaScript Debugging Tips and TricksJavaScript Debugging Tips and Tricks
JavaScript Debugging Tips and Tricks
 
AgileTD: Learning through osmosis
AgileTD: Learning through osmosisAgileTD: Learning through osmosis
AgileTD: Learning through osmosis
 
0514 matthew 57 blessed are the merciful power point church sermon
0514 matthew 57 blessed are the merciful power point church sermon0514 matthew 57 blessed are the merciful power point church sermon
0514 matthew 57 blessed are the merciful power point church sermon
 
AgileTD: Mob testing Training Day
AgileTD: Mob testing Training DayAgileTD: Mob testing Training Day
AgileTD: Mob testing Training Day
 

Similar to SD Ruby BDD Talk

Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Updimakovalenko
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011dimakovalenko
 
Graceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous IntegrationGraceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous IntegrationChris B. France
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript TestingScott Becker
 
How to implement ruby on rails testing practices to build a successful web ap...
How to implement ruby on rails testing practices to build a successful web ap...How to implement ruby on rails testing practices to build a successful web ap...
How to implement ruby on rails testing practices to build a successful web ap...Katy Slemon
 
Handling Non Functional Requirements on an Agile Project
Handling Non Functional Requirements on an Agile ProjectHandling Non Functional Requirements on an Agile Project
Handling Non Functional Requirements on an Agile ProjectKen Howard
 
Culture And Aesthetic Revisited
Culture And Aesthetic RevisitedCulture And Aesthetic Revisited
Culture And Aesthetic RevisitedAdam Keys
 
It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.cschaafsma
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHPGautam Rege
 
Ruby on Rails from the other side of the tracks
Ruby on Rails from the other side of the tracksRuby on Rails from the other side of the tracks
Ruby on Rails from the other side of the tracksinfovore
 
What rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovWhat rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovRuby Meditation
 
Rails Development That Doesn't Hurt
Rails Development That Doesn't HurtRails Development That Doesn't Hurt
Rails Development That Doesn't HurtAkira Matsuda
 
Single Page Apps - Gerry White @ BrightonSEO
Single Page Apps - Gerry White @ BrightonSEOSingle Page Apps - Gerry White @ BrightonSEO
Single Page Apps - Gerry White @ BrightonSEOGerry White
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunSQABD
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testingnyccamp
 
Getting Answers to Your Testing Questions
Getting Answers to Your Testing QuestionsGetting Answers to Your Testing Questions
Getting Answers to Your Testing Questionsjasnow
 
Frontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser renderingFrontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser renderingManuel Garcia
 

Similar to SD Ruby BDD Talk (20)

Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 
Graceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous IntegrationGraceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous Integration
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
How to implement ruby on rails testing practices to build a successful web ap...
How to implement ruby on rails testing practices to build a successful web ap...How to implement ruby on rails testing practices to build a successful web ap...
How to implement ruby on rails testing practices to build a successful web ap...
 
Handling Non Functional Requirements on an Agile Project
Handling Non Functional Requirements on an Agile ProjectHandling Non Functional Requirements on an Agile Project
Handling Non Functional Requirements on an Agile Project
 
Culture And Aesthetic Revisited
Culture And Aesthetic RevisitedCulture And Aesthetic Revisited
Culture And Aesthetic Revisited
 
It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.It's OK to make a new folder within Rails.
It's OK to make a new folder within Rails.
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
Intro to Rails
Intro to RailsIntro to Rails
Intro to Rails
 
Ruby on Rails from the other side of the tracks
Ruby on Rails from the other side of the tracksRuby on Rails from the other side of the tracks
Ruby on Rails from the other side of the tracks
 
What rails taught me – Eugene Pirogov
What rails taught me – Eugene PirogovWhat rails taught me – Eugene Pirogov
What rails taught me – Eugene Pirogov
 
Js basics
Js basicsJs basics
Js basics
 
Rails Development That Doesn't Hurt
Rails Development That Doesn't HurtRails Development That Doesn't Hurt
Rails Development That Doesn't Hurt
 
Single Page Apps - Gerry White @ BrightonSEO
Single Page Apps - Gerry White @ BrightonSEOSingle Page Apps - Gerry White @ BrightonSEO
Single Page Apps - Gerry White @ BrightonSEO
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD Fun
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing
 
Getting Answers to Your Testing Questions
Getting Answers to Your Testing QuestionsGetting Answers to Your Testing Questions
Getting Answers to Your Testing Questions
 
Frontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser renderingFrontend Performance: Illusions & browser rendering
Frontend Performance: Illusions & browser rendering
 

Recently uploaded

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 RobisonAnna Loughnan Colquhoun
 
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...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
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 DiscoveryTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
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 SavingEdi Saputra
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 WoodJuan lago vázquez
 
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 DevelopmentsTrustArc
 
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 Processorsdebabhi2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

Recently uploaded (20)

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
 
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...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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 - 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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

SD Ruby BDD Talk

  • 2. Presentation Notes Don’t bother to pound this into your laptops The whole thing is on: http://calicowebdev.com/tblog There 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 question Since 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, Sass OSS for last 10 years. Ruby/Rails since 2005 Still 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 Development BDD 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 Side Be patient. We’ll get to the real code.
  • 8. Tools I Use Ruby rSpec / rspec-rails Cucumber Faker Fixjour Again, all this stuff is on:http://calicowebdev.com/tblog
  • 9. Behavior vs. Test-Driven Development TDD Way def test_foo_is_seven assert_equal(7, @foo) end BDD Way describe @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 natural It’s more likely that you will spec first
  • 12. The Flow My personal work habits Bounce around between Cucumber and rSpec Create failing Scenario/Spec, then code to fix Build coverage and edge case handling as I can Try not to be too obsessive :)
  • 13. Cucumber: In One Sentence Story-based description of behaviors Divides specification into Feature > Scenario Tests from way outside, ignoring internals Not as focused as unit/functional tests Easier to miss edge cases Slower Killer for covering full stacks like Rails
  • 14. I Lied. Another Sentence Feature: 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 Blog Developing from the outside in First do a bit of plumbing Next write features Code to make them pass Drill down to specs where necessary Eventually, you want good coverage both at acceptance (Cuke) and spec level