Integration Test With Cucumber And Webrat
Upcoming SlideShare
Loading in...5
×
 

Integration Test With Cucumber And Webrat

on

  • 9,001 views

my talk about cucumber and webrat on ruby tuesday

my talk about cucumber and webrat on ruby tuesday

Statistics

Views

Total Views
9,001
Views on SlideShare
8,944
Embed Views
57

Actions

Likes
1
Downloads
49
Comments
0

2 Embeds 57

http://www.slideshare.net 52
http://coderwall.com 5

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Integration Test With Cucumber And Webrat Integration Test With Cucumber And Webrat Presentation Transcript

  • Integration Test with Cucumber and Webrat Kang-min Liu gugod@gugod.org
  • Integration Test • • • Web App:
  • : twitter
  • : twitter 1. http://twitter.com/home 2. status 3. update 4.
  • Webrat visit "http://twitter.com/home" fill_in "status", :with => "lorem ipsum" click_button "update" response.body.should =~ /lorem ipsum/
  • Webrat Browser emulation / control
  • Webrat • • • •
  • Webrat • javascript • css
  • Webrat • • Selenium • Watir
  • Webrat Core API • visit • select • click_link • attach_file • fill_in • click_button • check • uncheck • choose
  • Webrat Core API • visit, click_link • get + assert_response :success • click_button • submit form + assert_response :success • submit form default values if any
  • Webrat + RSpec describe "tweeting" do it "should show my tweets" do visit "/home" fill_in "status", :with => "lorem ipsum" click_button "update" response.body.should =~ /lorem ipsum/ end end
  • ?
  • Goods • • HTML •
  • Cucumber • BDD (Behavior Driven Development) Tool • Ruby implementation • •
  • Feature: Update my status In order to keep friends posted As a friendly person I post my status to twitter Scenario: Update my status Given I go to “/home” When I fill in “status” with “lorem ipsum” And I click “send” Then I should see “lorem ipsum”
  • Feature: Update my status In order to keep friends posted As a friendly person I post my status to twitter Scenario: Update my status Given I go to “/home” When I fill in “status” with “lorem ipsum” And I click “send” Then I should see “lorem ipsum”
  • Feature: Update my status In order to keep friends posted As a friendly person I post my status to twitter Scenario: Update my status Given I go to “/home” When I fill in “status” with “lorem ipsum” And I click “send” Then I should see “lorem ipsum”
  • Scenario: Update my status Given I go to “/home” When I fill in “status” with “lorem ipsum” And I click “send” Then I should see “lorem ipsum” Given – When – Then –
  • Given /^I go to "(.*)"$/ do |url| visit url end When /^I fill in "(.*)" with "(.*)"$/ do |field,value| fill_in field, :with => value end When /^I click "(.*)"$/ do |link| click_link(link) end Then /^I should see "(.*)"$/ do |text| response.body.should =~ /#{text}/m end
  • ?
  • Goods... • • • •
  • Goods... • •
  • Scenario: Update my status Given I go to “/home” When I fill in “status” with “lorem ipsum” And I click “send” Then I should see “lorem ipsum”
  • describe "tweeting" do it "should show my tweets" do visit "/home" fill_in "status", :with => "lorem ipsum" click_button "update" response.body.should =~ /lorem ipsum/ end end
  • Reference • Cucumber http://cukes.info/ • Webrat http://github.com/brynary/webrat/ tree/master • Test::Cukes http://search.cpan.org/dist/Test- Cukes/ (Perl implementation)