Telling Stories With RSpec

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    4 Favorites

    Telling Stories With RSpec - Presentation Transcript

    1. Telling Stories with RSpec Rahoul Baruah
    2. Functional Specifications • Functionality and Features • Sketches • Pages and pages of text
    3. Big Design Up Front • Estimates for cost and delivery dates • Agreement and sign-off • Misunderstandings • Software is Intangible • Change is inevitable
    4. “Agile” Development • Short descriptions of each feature • Testable and Verifiable • Easy to understand • Easy to manage • Easy to prioritise • Easy to change
    5. RSpec and Behaviour Driven Development • Getting the words right • It should do this • blue.should be_darker_than(turquoise) • Code as Specification
    6. Mock Objects • vat_calculator = mock ‘VAT Calculator’ • invoice.vat_calculator = vat_calculator • invoice.sub_total = 100 • vat_calculator.should_receive(:calculate).with(100).and_re turn(17.5) • invoice.total.should == 117.5
    7. Integration Tests • Test the full stack • Interactions between objects • Written as code
    8. RSpec User Stories • User Stories • Full Stack Testing • Plain Text plus Executables
    9. Story Structure • As a ... • I want ... • So that ...
    10. Scenarios • Different paths • Success and Errors • “Blank Slate”
    11. Given • Set up pre-requisites • Set up state • Given a user called Dave • And Dave is logged in
    12. When • Actions performed by the actor • When I click the ‘profile’ link • When I enter my new password and confirmation • And click the ‘Change my password’ button • Defined in terms of the user interface
    13. Then • Defines the results of your actions • Then I should see my profile page • And it should list how many items I have bought • Defined in terms of the user interface
    14. Steps • Given, When and Then • Text matchers, with parameters • Executable
    15. Test the Full-Stack • Specify in terms of User-Interface elements • Parse the DOM to check for results • Defines the user interface for the customer
    16. Webrat When “Dave logs in” do visit login_path fill_in ‘User Name’, :with => ‘Dave’ fill_in ‘Password’, :with => ‘secret’ click_button ‘Log In’ end
    17. RSpec Matchers Then “Dave’s profile page is shown” do response.should be_success response.should render_template(‘profiles/show’) response.should include_text(“Dave’s profile page”) end
    18. Cucumber • Structure for organising stories and steps • rake features • Is now part of RSpec
    19. Process • Write a Story • Write the first step • Write the specifications for the controllers • Write the controllers • Write the specifications for the models • Write the models • Run the Story • Write the next step
    20. References • RSpec • Cucumber • Webrat • JBehave • Celerity • HTMLUnit

    + Rahoul BaruahRahoul Baruah, 2 years ago

    custom

    1304 views, 4 favs, 1 embeds more stats

    An introduction to Behaviour Driven Development and more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1304
      • 1286 on SlideShare
      • 18 from embeds
    • Comments 0
    • Favorites 4
    • Downloads 51
    Most viewed embeds
    • 18 views on http://www.3hv.co.uk

    more

    All embeds
    • 18 views on http://www.3hv.co.uk

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories