Your SlideShare is downloading. ×
SD Ruby BDD Talk
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

SD Ruby BDD Talk

1,153
views

Published on

San Diego Ruby BDD Talk about rSpec and Cucumber

San Diego Ruby BDD Talk about rSpec and Cucumber

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,153
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Behavior Driven DevelopmentSDXP/SDRuby
    10,000 Foot Overview
  • 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

×