How to eat Cucmber
Upcoming SlideShare
Loading in...5
×
 

How to eat Cucmber

on

  • 3,024 views

 

Statistics

Views

Total Views
3,024
Views on SlideShare
2,917
Embed Views
107

Actions

Likes
4
Downloads
15
Comments
0

3 Embeds 107

http://d.hatena.ne.jp 103
http://www.linkedin.com 3
http://www.slideshare.net 1

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

    How to eat Cucmber How to eat Cucmber Presentation Transcript

    • Cucumber ( ) ○× sonic sonic id:nsgc
    • http://cukes.info/
    • Behaviour Driven Development with elegance and joy
    • !
    • Cucumber Cucumber Cucumber
    • Cucumber Cucumber Cucumber
    • Cucumber Cucumber Cucumber
    • Cucumber ? 35 Rails id:moro
    • Cucumber ? http://cukes.info/ Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format.
    • Cucumber ? http://cukes.info/ all rolled into one format DSL
    • ( )BDD ?
    • ( )BDD ?
    • ✓ Cucumber ✓ BDD ✓ BDD ✓ =
    • Cucumber Cucumber Cucumber
    • Cucumber
    • Cucumber
    • gem ✓ cucumber ✓ webrat ✓ nokogiri ※ ✓ rspec ✓ rspec-rails
    • Webrat Ruby Acceptance Testing for Web applications class SignupTest < ActionController::IntegrationTest def test_trial_account_sign_up visit home_path click_link "Sign up" fill_in "Email", :with => "good@example.com" select "Free account" click_button "Register" end end
    • Nokogiri HTML, XML, SAX, XSLT, Read require 'nokogiri' require 'open-uri' # Get a Nokogiri::HTML:Document for the page we’re interested in... doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove')) # Do funky things with it using Nokogiri::XML::Node methods... #### # Search for nodes by css doc.css('h3.r a.l').each do |link| puts link.content end #### # Search for nodes by xpath doc.xpath('//h3/a[@class="l"]').each do |link| puts link.content end #### # Or mix and match. doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link| puts link.content end
    • Nokogiri HTML, XML, SAX, XSLT, Read require 'nokogiri' require 'open-uri' # Get a Nokogiri::HTML:Document for the page we’re interested in... doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove')) # Do funky things with it using Nokogiri::XML::Node methods... #### # Search for nodes by css doc.css('h3.r a.l').each do |link| puts link.content end #### # Search for nodes by xpath doc.xpath('//h3/a[@class="l"]').each do |link| puts link.content end #### # Or mix and match. doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link| puts link.content end
    • Cucumber
    • $ruby script/generate cucumber
    • $ruby script/generate cucumber
    • features/step_definitions/webrat_steps.rb
    • features/step_definitions/webrat_steps.rb step features/step_definitions step step webrat_step.rb Given, When, Then Webrat Rspec
    • Webrat webrat_step.rb Rdoc visit(url = nil, http_method visit path_to(page_name) URL = :get, data = {}) click_button(button) click_button(value = nil) fill_in(field_locator, options fill_in(field, :with => value) = {}) ) RDocul.us http://docs.rdocul.us/webrat/master/ ramaze-users Webrat http://route477.net/ramaze/?Webrat
    • ✓ features/support/env.rb cucumber ✓ features/support/paths.rb path_to
    • Cucumber
    • $ruby script/generate feature Memo
    • $ruby script/generate feature Memo
    • features/manage_memos.feature
    • features/manage_memos.feature feature Feature: Scenario: Step Given When Then And
    • features/manage_memos.feature
    • features/manage_memos.feature
    • Cucumber
    • ✓ $rake features $cucumber featutes ✓ $cucumber features/manage_memos.feature
    • ✓ gem cucumber, webrat ✓ ruby script/generate cucumber cucumber ✓ ruby script/generate feature XXX XXX ✓ rake features cucumber
    • Cucumber Cucumber Cucumber
    • features/manage_memos.feature
    • features/manage_memos.feature ‘ ’, ‘ ’, ‘ ’, ‘ ’, ‘ ’, ‘ ’ ( ! )
    • ✓ step_definition step ✓
    • ?
    • moro-miso step_definition “ ” $gem sources --add http://gems.github.com $gem install moro-miso Cuke step_definition miso (id:moro ) http://d.hatena.ne.jp/moro/20090603/1244042258
    • $ruby script/generate miso
    • features/step_definitions/webrat_ja_steps.rb
    • ★ -l ja $cucumber features/manage_memos.feature -l ja $cucumber features -l ja
    • • •
    • NO MONEY
    • ?
    • ?
    • ✓ step_definition feature ✓ step_definition moro- miso ✓ step ✓ Rspec BDD
    • Cucumber ( ) ○× sonic sonic id:nsgc
    • Cucumber ( ) ○× sonic sonic id:nsgc
    • • Cucumber • • Rainbow •( ) !
    • • • autospec • • cucumber.el • Nokogiri xpath
    • !