Cucumber

965 views

Published on

A high level, integration testing framework

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

  • Be the first to like this

No Downloads
Views
Total views
965
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • (possibly even javascript or flash)
    (to later be interpreted into ruby)
  • Scenario is made up of many steps, defined with regex
  • Scenario is made up of many steps, defined with regex
  • Cucumber provides prewritten steps (webrat.steps)
  • translate plain english into a resource path (URL) with regex
  • Steps that will be run for all scenarios in a feature
  • Cucumber

    1. 1. CUCUMBER A high level, integration testing framework
    2. 2. • Testing the entire stack • Designed to create applications via BDD • Define behavior in plain english, not "code"
    3. 3. WORK FLOW 1. Feature - integration test 2. Spec - unit test 3. Code
    4. 4. FEATURES Feature... name In order... goal As a... role I want... action
    5. 5. FEATURES # manage_articles.feature Feature: Manage Articles In order to make a blog As an author I want to create articles
    6. 6. SCENARIOS Scenario... name Given... setup When... exercise Then... test
    7. 7. SCENARIOS # manage_articles.feature Scenario: Articles List Given I have articles titled Pizza, Breadsticks When I go to the list of articles Then I should see "Pizza" And I should see "Breadsticks"
    8. 8. STEPS # manage_articles_steps.rb Given /^I have articles titled (.+)$/ do |titles| titles.split(', ').each do |title| Article.create!(:title => title) end end
    9. 9. PATHS # paths.rb # When I go to the list of articles def path_to(page_name) case page_name when /the list of articles/ articles_path end end
    10. 10. BACKGROUND # manage_articles.feature Background: Given the following user records | username | password | admin | | bob | secret | false | | admin | secret | true | Scenario: Protect articles from regular users Given I am logged in as "bob" When I visit the list of articles And I press "Delete all" Then I should see "Sorry you cannot do that" Scenario: Delete articles as admin Given I am logged in as "bob" When I visit the list of articles And I press "Delete all" Then I should see "Articles deleted”
    11. 11. RESOURCES • http://cuckes.info • http://wiki.github.com/brynary/webrat • http://rubular.com • http://ianwhite.github.com/pickle/

    ×