Cucumber: 小黃瓜驗收測試工具

5,847 views

Published on

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

No Downloads
Views
Total views
5,847
On SlideShare
0
From Embeds
0
Number of Embeds
748
Actions
Shares
0
Downloads
112
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Cucumber: 小黃瓜驗收測試工具

  1. Cucumber ihower@handlino.com
  2. about me • (a.k.a ihower) http://ihower.idv.tw/blog/ • http://handlino.com http://registrano.com
  3. Q: In order ... As a COSCUP 2009 attendee I want ...
  4. Q: In order ... [business value] As a COSCUP 2009 attendee [role] I want ... [feature]
  5. ? What’s your acceptance criteria?
  6. Scenario: COSCUP 2009 Given When ihower Then And
  7. “I believe that the hardest part of software projects, the most common source of project failure, is communication with the customers and users of that software. By providing a clear yet precise language to deal with domains, a DSL can help improve this communication.” Martin Fowler
  8. “ (DSL) ” Martin Fowler
  9. (DSL) ?
  10. Cucumber Ruby Feature
  11. Cucumber Feature Feature: { Scenario: Given < > And < > When < > And < > Then < > And < >
  12. Given Given /^ (.*)$/ do |fruit| #.... your test code assert_equal(fruit, ' ') end Ruby
  13. Given Given /^ (.*)$/ do |fruit| #.... your test code assert_equal(fruit, ' ') end Ruby
  14. Given Regexp match Given /^ (.*)$/ do |fruit| #.... your test code assert_equal(fruit, ' ') end Ruby
  15. Cucumber • Ruby and Rails • JRuby and Java • IronRuby and .NET • FunFX and Flex • Web apps in any lanuages, with: • Watir, Selenium, Mechanize, Webrat
  16. Cucumber огурец Russian concombre French Japanese Okurkový Czech Gurke German Cucumber English pepino Spanish !! Korean cetriolo Italian gurka Swedish agurk Danish castravete Romanian Arabic ‫ﺍﳋﻴﺎﺭ‬ ogórek Polish ketimun Indonesian Kurk Estonian Hebrew ‫מְלָפְפֹון‬ dưa chuột Vietnamese Cogombre Catalan uhorka Slovak CUCUMBR LOLCats gurķis Latvian Agurk Norwegian Agurkas Lithuanian 黄 !! Korean Salátauborka Hungarian gurka Swedish Kurkku Finnish castravete Romanian Краставица Bulgarian ogórek Polish Pepino Portuguese Kurk Estonian dưa chuột Vietnamese uhorka Slovak gurķis Latvian Agurkas Lithuanian Salátauborka Hungarian Kurkku Finnish Краставица Bulgarian Pepino Portuguese
  17. Feature :               :      3      2      divide      1.5
  18. Ruby code Given / (d+)/ do |n| @calc.push n.to_i end When / (w+)/ do |op| @result = @calc.send op end Then / (.*)/ do |result| @result.should == result.to_f end
  19. Web Integration Testing
  20. Feature: Scenario: Given I am on the "1934356085" book page When I press "Add to Cart" Then I should see "Programming Ruby 1.9"
  21. Ruby Code Given /^I am on (.+)$/ do |page_name| visit path_to(page_name) end When /^I press "([^"]*)"$/ do |button| click_button(button) end Then /^I should see "([^"]*)"$/ do |text| response.should contain(text) end
  22. Ruby Code Given /^I am on (.+)$/ do |page_name| visit path_to(page_name) end When /^I press "([^"]*)"$/ do |button| click_button(button) end Then /^I should see "([^"]*)"$/ do |text| response.should contain(text) end
  23. { 1: 2: Ruby Outside 3: (fail) 4. (pass) Inside { 4-1. 4-2 Unit Test (Fail) (Pass)
  24. thank you. http://cukes.info/

×