SlideShare une entreprise Scribd logo
1  sur  15
 
  ,[object Object],[object Object],[object Object],[object Object]
  Cucumber + Capybara + Selenium Webdriver + Ruby
Структура |~ features /                   | |~ step_definitions /         | | |-person_steps.rb         | | `-web_steps.rb            | |~ support /                  | | |-env.rb                  | | `-paths.rb                | |-addtocontacts.feature     | |-attachimage.feature       | |-chpass.feature            | |-ignore.feature            | |-ims.feature               | |-login.feature             | |-logout.feature            | |-present.feature           | `-registeration.feature     |~ lib /                        | `+ faker /                    `+data/                       
Feature: Login                                             In order to manage my private data                       As a person.com user                                     I want to login                                                                                               Scenario: Normal login                                     Given  I am on the home page                              When  I fill in "login" with "value"        And I fill in password field "passwd" with "value1"     And I press "login"                                      Then  I should see "My Stuff"     But I should not see "ERROR: Invalid password!"                                                                                 Scenario: Invalid login with bad login                     Given  I am on the home page                              When  I fill in "login" with "value1"                     And I fill in password field "passwd" with "value2"      And I press "login"                                      Then  I should see "NO Login"                                                                                  Scenario: Invalid login with incorrect password            Given  I am on the home page                              When  I fill in "login" with "value"        And I press "login"                                      Then  I should see "ERROR: Invalid password!"
Scenario   Outline : eating    Given  there are <start> cucumbers    When  I eat <eat> cucumbers    Then  I should have <left> cucumbers    Examples :      | start | eat | left |      |  12   |  5  |  7   |      |  20   |  5  |  15  | Given  the following people exist:    | name  | email           | phone |    | Aslak | aslak@email.com | 123   |    | Joe   | joe@email.com   | 234   |    | Bryan | bryan@email.org | 456   |
Feature:  Registration     In order to start using site     As a new user     I want to register Scenario:  Normal registration      Given  I am on the home page      When  I fill in &quot;email&quot; with random email     And I fill in &quot;fullname&quot; with &quot;MyNameIs&quot;     And I fill in &quot;nickname&quot; with &quot;MyNicknameIs&quot;     And I choose &quot;gender_1&quot;     And I select &quot;10&quot; from &quot;birthday_day&quot;     And I select &quot;March&quot; from &quot;birthday_month&quot;     And I select &quot;1986&quot; from &quot;birthday_year&quot;     And I fill in &quot;city&quot; with &quot;Antarctica, Antarctica, Antarctica&quot;     And I fill in &quot;password&quot; with &quot;testpass&quot;     And I fill in &quot;city&quot; with &quot;Antarct&quot;     And I click to city autocomplete item with &quot;Antarctica&quot;     And I press &quot;button_submit&quot;      Then  I should see &quot;Thank you for registration!&quot;
Given /^(?:|I )am on (.+)$/   do   |page_name|   visit path_to(page_name) end   When /^(?:|I )press &quot;([^&quot;]*)&quot;(?: within &quot;([^&quot;]*)&quot;)?$/   do  |button, selector|   with_scope(selector) do     click_button(button)    end end   Then /^(?:|I )should not see &quot;([^&quot;]*)&quot;(?: within &quot;([^&quot;]*)&quot;)?$/  do  |text, selector|   with_scope(selector) do     if page.respond_to? :should       page.should have_no_content(text)     else       assert page.has_no_content?(text)      end   end end   When /^(?:|I )fill in &quot;([^&quot;]*)&quot; with random email(?: within &quot;([^&quot;]*)&quot;)?$/   do  |field, selector|   @email = Faker::Internet.email   with_scope(selector) do     fill_in(field, :with => @email)    end end
 
Пример ошибки при выполнении
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Непрерывное системное тестирование   integrity + cucumber + selenium на VPS
The RSpec Book
Спасибо за внимание =)

Contenu connexe

Tendances

Story-driven Testing
Story-driven TestingStory-driven Testing
Story-driven TestingBrian Hogan
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentationbryanbibat
 
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITPLecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITPyucefmerhi
 
Google Sites Web Page Creation
Google Sites Web Page CreationGoogle Sites Web Page Creation
Google Sites Web Page CreationBrian Stumbaugh
 
The Users are Restless
The Users are RestlessThe Users are Restless
The Users are RestlessTerry Ryan
 
Ruby testing tools
Ruby testing toolsRuby testing tools
Ruby testing toolsbsgbryan
 
Ruby testing tools
Ruby testing toolsRuby testing tools
Ruby testing toolsbsgbryan
 
HTML Design for Devices
HTML Design for DevicesHTML Design for Devices
HTML Design for DevicesTerry Ryan
 
Evolution of API With Blogging
Evolution of API With BloggingEvolution of API With Blogging
Evolution of API With BloggingTakatsugu Shigeta
 
Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Dean Peters
 

Tendances (19)

Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
 
Story-driven Testing
Story-driven TestingStory-driven Testing
Story-driven Testing
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
Embedding shelfari widget
Embedding shelfari widgetEmbedding shelfari widget
Embedding shelfari widget
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
 
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITPLecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITP
 
Google Sites Web Page Creation
Google Sites Web Page CreationGoogle Sites Web Page Creation
Google Sites Web Page Creation
 
The Users are Restless
The Users are RestlessThe Users are Restless
The Users are Restless
 
Ruby testing tools
Ruby testing toolsRuby testing tools
Ruby testing tools
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
Ruby testing tools
Ruby testing toolsRuby testing tools
Ruby testing tools
 
A More Perfect Union with CSS
A More Perfect Union with CSSA More Perfect Union with CSS
A More Perfect Union with CSS
 
HTML Design for Devices
HTML Design for DevicesHTML Design for Devices
HTML Design for Devices
 
Evolution of API With Blogging
Evolution of API With BloggingEvolution of API With Blogging
Evolution of API With Blogging
 
Sinatra
SinatraSinatra
Sinatra
 
Changing Template Engine
Changing Template EngineChanging Template Engine
Changing Template Engine
 
Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...Using the Google Analytics API to make most popular pages widgets for your we...
Using the Google Analytics API to make most popular pages widgets for your we...
 
Object width
Object widthObject width
Object width
 
Largamos o cucumber
Largamos o cucumberLargamos o cucumber
Largamos o cucumber
 

En vedette

AntonSaburov (Gemini-Systems) @ CodeCamp2011
AntonSaburov (Gemini-Systems) @ CodeCamp2011AntonSaburov (Gemini-Systems) @ CodeCamp2011
AntonSaburov (Gemini-Systems) @ CodeCamp2011CodeCamp
 
VladimirKolesnikov (Microsoft) @ CodeCamp2011
VladimirKolesnikov (Microsoft) @ CodeCamp2011VladimirKolesnikov (Microsoft) @ CodeCamp2011
VladimirKolesnikov (Microsoft) @ CodeCamp2011CodeCamp
 
Tablet marketing accenture global_consumertech_2011
Tablet marketing accenture global_consumertech_2011Tablet marketing accenture global_consumertech_2011
Tablet marketing accenture global_consumertech_2011Aradhana Sarma
 
Marketing Through Mobile
Marketing Through MobileMarketing Through Mobile
Marketing Through Mobilebrendeezyy
 
PetrKerzum (Yandex) @ CodeCamp2011
PetrKerzum (Yandex) @ CodeCamp2011PetrKerzum (Yandex) @ CodeCamp2011
PetrKerzum (Yandex) @ CodeCamp2011CodeCamp
 
MichailZavileysky (DataArt) @ CodeCamp2011
MichailZavileysky (DataArt) @ CodeCamp2011MichailZavileysky (DataArt) @ CodeCamp2011
MichailZavileysky (DataArt) @ CodeCamp2011CodeCamp
 
VadimSabashny (Lanit-Tercom) @ CodeCamp2011
VadimSabashny (Lanit-Tercom) @ CodeCamp2011VadimSabashny (Lanit-Tercom) @ CodeCamp2011
VadimSabashny (Lanit-Tercom) @ CodeCamp2011CodeCamp
 

En vedette (8)

AntonSaburov (Gemini-Systems) @ CodeCamp2011
AntonSaburov (Gemini-Systems) @ CodeCamp2011AntonSaburov (Gemini-Systems) @ CodeCamp2011
AntonSaburov (Gemini-Systems) @ CodeCamp2011
 
VladimirKolesnikov (Microsoft) @ CodeCamp2011
VladimirKolesnikov (Microsoft) @ CodeCamp2011VladimirKolesnikov (Microsoft) @ CodeCamp2011
VladimirKolesnikov (Microsoft) @ CodeCamp2011
 
Loco
LocoLoco
Loco
 
Tablet marketing accenture global_consumertech_2011
Tablet marketing accenture global_consumertech_2011Tablet marketing accenture global_consumertech_2011
Tablet marketing accenture global_consumertech_2011
 
Marketing Through Mobile
Marketing Through MobileMarketing Through Mobile
Marketing Through Mobile
 
PetrKerzum (Yandex) @ CodeCamp2011
PetrKerzum (Yandex) @ CodeCamp2011PetrKerzum (Yandex) @ CodeCamp2011
PetrKerzum (Yandex) @ CodeCamp2011
 
MichailZavileysky (DataArt) @ CodeCamp2011
MichailZavileysky (DataArt) @ CodeCamp2011MichailZavileysky (DataArt) @ CodeCamp2011
MichailZavileysky (DataArt) @ CodeCamp2011
 
VadimSabashny (Lanit-Tercom) @ CodeCamp2011
VadimSabashny (Lanit-Tercom) @ CodeCamp2011VadimSabashny (Lanit-Tercom) @ CodeCamp2011
VadimSabashny (Lanit-Tercom) @ CodeCamp2011
 

Similaire à 2_cucumber

User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)Jean-Michel Garnier
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice Itlinoj
 
Testing ASP.net and C# using Ruby (NDC2010)
Testing ASP.net and C# using Ruby (NDC2010)Testing ASP.net and C# using Ruby (NDC2010)
Testing ASP.net and C# using Ruby (NDC2010)Ben Hall
 
Make Everyone a Tester: Natural Language Acceptance Testing
Make Everyone a Tester: Natural Language Acceptance TestingMake Everyone a Tester: Natural Language Acceptance Testing
Make Everyone a Tester: Natural Language Acceptance TestingViget Labs
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunSQABD
 
Php Form
Php FormPhp Form
Php Formlotlot
 
Largamos o Cucumber!
Largamos o Cucumber!Largamos o Cucumber!
Largamos o Cucumber!iMasters
 
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Aslak Hellesøy
 
MoneyBird - The Rails Side
MoneyBird - The Rails SideMoneyBird - The Rails Side
MoneyBird - The Rails SideEdwin Vlieg
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItCarsonified Team
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ LingoIndicThreads
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Jean-Loup Yu
 
Integration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratIntegration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratKang-min Liu
 
Have Better Toys
Have Better ToysHave Better Toys
Have Better Toysapotonick
 
Re-using social media data
Re-using social media dataRe-using social media data
Re-using social media dataGlenn Jones
 

Similaire à 2_cucumber (19)

User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
 
Form Validation
Form ValidationForm Validation
Form Validation
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice It
 
Testing ASP.net and C# using Ruby (NDC2010)
Testing ASP.net and C# using Ruby (NDC2010)Testing ASP.net and C# using Ruby (NDC2010)
Testing ASP.net and C# using Ruby (NDC2010)
 
Make Everyone a Tester: Natural Language Acceptance Testing
Make Everyone a Tester: Natural Language Acceptance TestingMake Everyone a Tester: Natural Language Acceptance Testing
Make Everyone a Tester: Natural Language Acceptance Testing
 
CUCUMBER - Making BDD Fun
CUCUMBER - Making BDD FunCUCUMBER - Making BDD Fun
CUCUMBER - Making BDD Fun
 
Php Form
Php FormPhp Form
Php Form
 
Largamos o Cucumber!
Largamos o Cucumber!Largamos o Cucumber!
Largamos o Cucumber!
 
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
 
Zend Form Tutorial
Zend Form TutorialZend Form Tutorial
Zend Form Tutorial
 
MoneyBird - The Rails Side
MoneyBird - The Rails SideMoneyBird - The Rails Side
MoneyBird - The Rails Side
 
Neil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do It
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ Lingo
 
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
Green Light for the Apps with Calaba.sh - DroidCon Paris 2014
 
Integration Test With Cucumber And Webrat
Integration Test With Cucumber And WebratIntegration Test With Cucumber And Webrat
Integration Test With Cucumber And Webrat
 
Have Better Toys
Have Better ToysHave Better Toys
Have Better Toys
 
Forms 2010
Forms 2010Forms 2010
Forms 2010
 
Re-using social media data
Re-using social media dataRe-using social media data
Re-using social media data
 
YQL talk at OHD Jakarta
YQL talk at OHD JakartaYQL talk at OHD Jakarta
YQL talk at OHD Jakarta
 

2_cucumber

  • 1.  
  • 2.
  • 3.   Cucumber + Capybara + Selenium Webdriver + Ruby
  • 4. Структура |~ features /                   | |~ step_definitions /         | | |-person_steps.rb         | | `-web_steps.rb            | |~ support /                  | | |-env.rb                  | | `-paths.rb                | |-addtocontacts.feature     | |-attachimage.feature       | |-chpass.feature            | |-ignore.feature            | |-ims.feature               | |-login.feature             | |-logout.feature            | |-present.feature           | `-registeration.feature     |~ lib /                        | `+ faker /                    `+data/                       
  • 5. Feature: Login                                             In order to manage my private data                       As a person.com user                                     I want to login                                                                                               Scenario: Normal login                                     Given I am on the home page                              When I fill in &quot;login&quot; with &quot;value&quot;        And I fill in password field &quot;passwd&quot; with &quot;value1&quot;     And I press &quot;login&quot;                                      Then I should see &quot;My Stuff&quot;    But I should not see &quot;ERROR: Invalid password!&quot;                                                                                Scenario: Invalid login with bad login                     Given I am on the home page                              When I fill in &quot;login&quot; with &quot;value1&quot;                     And I fill in password field &quot;passwd&quot; with &quot;value2&quot;      And I press &quot;login&quot;                                      Then I should see &quot;NO Login&quot;                                                                                  Scenario: Invalid login with incorrect password            Given I am on the home page                              When I fill in &quot;login&quot; with &quot;value&quot;        And I press &quot;login&quot;                                      Then I should see &quot;ERROR: Invalid password!&quot;
  • 6. Scenario Outline : eating    Given there are <start> cucumbers    When I eat <eat> cucumbers    Then I should have <left> cucumbers    Examples :      | start | eat | left |      |  12   |  5  |  7   |      |  20   |  5  |  15  | Given  the following people exist:    | name  | email           | phone |    | Aslak | aslak@email.com | 123   |    | Joe   | joe@email.com   | 234   |    | Bryan | bryan@email.org | 456   |
  • 7. Feature: Registration     In order to start using site     As a new user     I want to register Scenario: Normal registration     Given I am on the home page     When I fill in &quot;email&quot; with random email     And I fill in &quot;fullname&quot; with &quot;MyNameIs&quot;     And I fill in &quot;nickname&quot; with &quot;MyNicknameIs&quot;     And I choose &quot;gender_1&quot;     And I select &quot;10&quot; from &quot;birthday_day&quot;     And I select &quot;March&quot; from &quot;birthday_month&quot;     And I select &quot;1986&quot; from &quot;birthday_year&quot;     And I fill in &quot;city&quot; with &quot;Antarctica, Antarctica, Antarctica&quot;     And I fill in &quot;password&quot; with &quot;testpass&quot;     And I fill in &quot;city&quot; with &quot;Antarct&quot;     And I click to city autocomplete item with &quot;Antarctica&quot;     And I press &quot;button_submit&quot;     Then I should see &quot;Thank you for registration!&quot;
  • 8. Given /^(?:|I )am on (.+)$/ do |page_name|   visit path_to(page_name) end   When /^(?:|I )press &quot;([^&quot;]*)&quot;(?: within &quot;([^&quot;]*)&quot;)?$/ do |button, selector|   with_scope(selector) do     click_button(button)   end end   Then /^(?:|I )should not see &quot;([^&quot;]*)&quot;(?: within &quot;([^&quot;]*)&quot;)?$/ do |text, selector|   with_scope(selector) do     if page.respond_to? :should       page.should have_no_content(text)     else       assert page.has_no_content?(text)     end   end end When /^(?:|I )fill in &quot;([^&quot;]*)&quot; with random email(?: within &quot;([^&quot;]*)&quot;)?$/ do |field, selector|   @email = Faker::Internet.email   with_scope(selector) do     fill_in(field, :with => @email)   end end
  • 9.  
  • 10. Пример ошибки при выполнении
  • 11.
  • 12.
  • 13. Непрерывное системное тестирование   integrity + cucumber + selenium на VPS