SlideShare uma empresa Scribd logo
1 de 43
Ketan Soni
@ketan_soni
Atreyee Maiti
@AtreyeeMaiti
Cucumber is meant to provide stakeholders a way
to express specifications in plain english. All
team members can be on the same page about the
specifications. Also since this is automated, you
effectively have executable specifications.


Cucumber consists of feature files which has
scenarios in given, when then statements and
corresponding implementation of those in
step_definition files.
Scenario: Purchasing books online
 Given I have selected following books in my
shopping cart:
     |title              | price|
     |Sherlock Homes |12.35 |
     |Little Women   |5.00 |
 When I proceed to checkout
 And I fill out the billing and shipping details
 And I give my credit card details
 Then I should see the order confirmation message
We will look at a sample scenario and
try and analyse what’s wrong in the
way it is written
Scenario: User should be able to verify items in his shopping cart
and proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email
“jdoe@gmail.com”
And I have a product “Kindle” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my
shopping cart.
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart
overlay
When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page“
When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”
Then I should see my shipping details on the order confirmation
page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com”
And I have a product “Kindle” with price “50$” in
products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.

When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Step rewritten:

Given following products are available:
 |product title| price |
 |Kindle      | 50.00 |
 |ipad        | 50.00 |
And product “ipad” is available with following
options:
 |product option|product option value|
 | colour       | white           |
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com”
And I have a product “Kindle” with price “50$” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color
“white” in my shopping cart.
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and proceed to checkout by
filling in billing and shipping details.
Step rewritten:

And I add the following to my shopping cart:
|product name|product option|option value|quantity|
| kindle      | color        | white     |      2 |
| ipad        |              |           |      2 |
And I have a product “Kindle” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart.

When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com”
And I have a product “Kindle” with price “50$” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.

   When I click on view shopping cart within
“//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
filling in billing and shipping details.
Step rewritten:

When I view the shopping cart

When /^I view the shopping cart$/ do
  with_scope(Sections::MAP[“header”]) do
    click_link(“Shopping Cart”)
  end
end
And I have a product “Kindle” in products list
And product “ipad" exists with color “white”
                                                        e.g. sections. rb
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart.

                                                        module Sections
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
                                                             MAP =
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"
                                                             {
When I fill in “First Name” with “John”                        „header' =>
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”             '//div[@id=„header‟]„
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
                                                             }
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
                                                          end
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com”
And I have a product “Kindle” with price “50$” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

When I fill in “First Name” with “John”
And I fill in “Last Name” with “Doe”
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and proceed to checkout by
When I view the shopping cart

When /^I view the shopping cart$/ do
  with_scope(sections[“header”]) do
    click_link(“Shopping Cart”)
  end
  And %{wait for element to appear
sections[„cart‟]”}
End

When /^wait for element to appear "([^"]*)"$/ do
|selector|
  loop_until { find(:xpath, selector).visible? }
end
And I fill in “Email” with “jdoe@gmail.com”
And I fill in “Address” with “Chicago, IL”
And I select “US” from “Country”
Then the countries list should show all countries
And I fill in “Zipcode” with “60601”
When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

     When I fill in “First Name” with “John”
     And I fill in “Last Name” with “Doe”
     And I fill in “Email” with “jdoe@gmail.com”
     And I fill in “Address” with “Chicago, IL”
     And I select “US” from “Country”
     Then the countries list should show all
countries
     And I fill in “Zipcode” with “60601”
     When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

     When I fill in “First Name” with “John”
     And I fill in “Last Name” with “Doe”
     And I fill in “Email” with “jdoe@gmail.com”
     And I fill in “Address” with “Chicago, IL”
     And I select “US” from “Country”
     Then the countries list should show all
countries
     And I fill in “Zipcode” with “60601”
     When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Step rewritten:
When I fill in my billing details
And I choose to keep shipping address same as
billing

When /^I fill in my billing details$/ do
  fill_in(“first_name”, :with => “John”)
  fill_in(“last_name”, :with => “Doe”)
  fill_in(“email”, :with => “jdoe@gmail.com”)
  fill_in(“address”, :with => “Chicago, IL”)
  fill_in(“zipcode”, :with => “John”)
  select(“US”, :from => “Country”)
End

When /^I choose to keep shipping address same as
billing$/ do
 check(“shipping_same_as_billing”)
End
And I fill in “Address” with “Chicago, IL”
And I press “Next”
Step rewritten:
When I fill in my billing details
And I choose to keep shipping address same as
billing

When /^I fill in my billing details$/ do
  fill_in(“first_name”, :with => “John”)
  fill_in(“last_name”, :with => “Doe”)
  fill_in(“email”, :with => “jdoe@gmail.com”)
  fill_in(“address”, :with => “Chicago, IL”)
  fill_in(“zipcode”, :with => “John”)
  select(“US”, :from => “Country”)
End

When /^I choose to keep shipping address same as
billing$/ do
 check(“shipping_same_as_billing”)
End
And I fill in “Address” with “Chicago, IL”
And I press “Next”
Scenario: User should be able to verify items in his shopping cart and
proceed to checkout by filling in billing and shipping details.
Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com”
And I have a product “Kindle” with price “50$” in products list
And product “ipad" exists with color “white”
And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping
cart.

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

     When I fill in “First Name” with “John”
     And I fill in “Last Name” with “Doe”
     And I fill in “Email” with “jdoe@gmail.com”
     And I fill in “Address” with “Chicago, IL”
     And I select “US” from “Country”
     Then the countries list should show all
countries
     And I fill in “Zipcode” with “60601”
     When I check “shipping_same_as_billing”
And I press “Next”

Then I should see my shipping details on the order confirmation page
Then I should see my shipping details on the order
confirmation page

When I press "//span[@id='proceed_to_checkout']" button
Then /^I should see my shipping details on the
order confirmation page$/ do
 shipping_details = @user.shipping_address
 [:fist_name, :email, :zipcode].each do |field|
 Then %{I should see “#{shipping_details[field]}”}
end
om “Country”
          Then the countries list should show all countries

       This step depends on
          And I fill in “Zipcode” with “60601”
          When I check “shipping_same_as_billing”

       an instance variable
And I press “Next”


       being populated from
       some previous step
Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing
and shipping details.
Given I have a user "john“ with last name “doe” and email jdoe@gmail.com
When I click on view shopping cart within “//div[@id=header]”
And I wait “10"
Then I should see "Kindle" and “ipad" in the view shopping cart overlay
Then I should see my shipping details on the order
confirmation page

When I press "//span[@id='proceed_to_checkout']" button
Then I see the page title as "Billing Page"

            When I fill in “First Name” with “John”
            And I fill in “Last Name” with “Doe”
            And I fill in “Email” with “jdoe@gmail.com
Then /^I should see my shipping details on the
order confirmation page$/ do
 shipping_details = @user.shipping_address
 [:fist_name, :email, :zipcode].each do |field|
 Then %{I should see “#{shipping_details[field]}”}
end
om “Country”
          Then the countries list should show all countries
          And I fill in “Zipcode” with “60601”
          When I check “shipping_same_as_billing”
And I press “Next”
Scenario: User should be able to verify items in his shopping cart and proceed to checkout by
filling in billing and shipping details.
Then I should see shipping details for user “john”
on the order confirmation page

Then /^I should see shipping details for user
“(.*)” on the order confirmation page$/ do
|identifier|
 user = User.find_by_identifier(identifier)
 shipping_details = user.shipping_address
 [:fist_name, :email, :zipcode].each do |field|
 Then %{I should see “#{shipping_details[field]}”}
end
               Send in unique
Then the countries list should show socountries the
               identifiers all that
And I select “US” from “Country”

And I fill in “Zipcode” with “60601”
               specific record can be
When I check “shipping_same_as_billing”
And I press “Next”

               retrieved and testing can
Then I should see my shipping details on the order confirmation page

               be done
Given I have a user with details as:
 |first name| John         |
 |last name | Doe            |
 |email     | jdoe@gmail.com|
Given following products are available:
 |product title| price |
 |Kindle        | 50.00 |
 |ipad         | 50.00 |
And product “ipad” is available with following options:
 |product option|product option value|
 | colour        | white                |
And I add the following to my shopping cart:
|product title|product option|option value| quantity |
| kindle       | color        | white     |        2 |
| ipad         |               |          |        2 |
When I view the shopping cart
Then I should see the following items in “Cart” section:
  | product |quantity|
  |kindle   |2      |
  | ipad    |1      |
When I proceed to checkout
When I fill in my billing details
And I choose to keep shipping address same as billing
And I submit the billing form
Then I should see shipping details for user “john” on the order
confirmation page
Use the rerun profile feature (with caution!)

 rerun = File.file?('rerun.txt') ?
 IO.read('rerun.txt') : ""
 rerun_opts = rerun.to_s.strip.empty? ? "--format
 #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" :
 "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}
 #{rerun}"
 %>
 rerun: <%= rerun_opts %> --format rerun --out
 rerun.txt --strict --tags ~@wip
Backdoor entry for login:




  Quite often end to end scenarios consist of a user
  getting logged in and then doing things on the
  app. You need not repeat the complicated login
  process (via the ui). Simply get the user logged in
  the fastest way via a backdoor entry. Saves a lot of
  time !! Cut down 5 mins in a feature file.
Backdoor entry for login:
Without backdoor                    With backdoor

When /^I log in as "([^"]*)"       Given /^I am logged in as
with password "([^"]*)" without    "(.*)"$/ do |screen_name|
overlay$/ do |email, password|      url =
When %{I go to the login page}      "/backdoor/#{screen_name}“
When %{authenticate user call to    visit url
cis is stubbed to return            end
"<user><id>1</id></user>"}
When %{search user call to cis is
stubbed to return
"<user><id>1</id></user>"}
When %{I fill in "email" with
"#{email}"}
When %{I fill in "password" with
"#{password}"}
When %{I press "login"}
And %{I wait "1"}
  @logged_in_user =
User.find_by_email(email)
end
if Rails.env.test?
  get "/backdoor/:screen_name", :to =>
 "sessions#backdoor", :as => "backdoor“
end

def backdoor
  user =
 User.find_by_screen_name(params[:screen_na
 me])
  set_current_user(user)
  head :ok
end
   Do not use page.has_xpath? should be false. Go for
    page.should_not have_xpath.

Has_xpath? would try repeatedly (till capybara timeout)
to find the element. When it doesn’t find it, the value
returned would be false which would match with the
assert. Rather than that use has_no_xpath? So then
capybara exits the first time itself when it does not find
the element. Will save a lot of time!!! Cut down build
time by 7 mins for us!
   Use scenario outlines with caution




       Scenario outlines should be used only if
       you actually need the whole scenario to be
       repeated for your examples not otherwise.
When /^I fill in my billing details$/ do
  And %{I fill in “first_name” with “John”}
  And %{I fill in “zipcode” with “John”}
  And %{I select “US” from “Country”}
End

When /^I fill in my billing details$/ do
  fill_in(“first_name”, :with => “John”)
  fill_in(“zipcode”, :with => “John”)
  select(“US”, :from => “Country”)
End


Rather than dealing with regex matches deal with
capybara methods which are equally readable.
Introduce methods, modules, and keep your code dry
and clean.
Stop doing   Start doing
Happy cuking…
   http://benmabey.com/2008/05/19/imperative-vs-declarative-
    scenarios-in-user-stories.html
   http://elabs.se/blog/15-you-re-cuking-it-wrong
   mislav.uniqpath.com/2010/09/cuking-it-right/
   http://aslakhellesoy.com/post/11055981222/the-training-wheels-
    came-off
   http://skillsmatter.com/podcast/home/refuctoring-your-cukes

Mais conteúdo relacionado

Destaque

а.с.пушкин 'капитанская дочка'
а.с.пушкин 'капитанская дочка'а.с.пушкин 'капитанская дочка'
а.с.пушкин 'капитанская дочка'11qwerasdf
 
Cure to World Hunger
Cure to World HungerCure to World Hunger
Cure to World Hungerltries
 
Cultivating codeless contributors
Cultivating codeless contributorsCultivating codeless contributors
Cultivating codeless contributorsmeldra
 
A golden era for Open Access or a trend towards the golden road to Open Access?
A golden era for Open Access or a trend towards the golden road to Open Access?A golden era for Open Access or a trend towards the golden road to Open Access?
A golden era for Open Access or a trend towards the golden road to Open Access?Dirk_Pieper
 
Open APC Data in Germany - A Contribution to Open Access Monitoring
Open APC Data in Germany - A Contribution to Open Access MonitoringOpen APC Data in Germany - A Contribution to Open Access Monitoring
Open APC Data in Germany - A Contribution to Open Access MonitoringDirk_Pieper
 
курсова робота
курсова роботакурсова робота
курсова роботаSpring91
 

Destaque (7)

а.с.пушкин 'капитанская дочка'
а.с.пушкин 'капитанская дочка'а.с.пушкин 'капитанская дочка'
а.с.пушкин 'капитанская дочка'
 
Cure to World Hunger
Cure to World HungerCure to World Hunger
Cure to World Hunger
 
Cultivating codeless contributors
Cultivating codeless contributorsCultivating codeless contributors
Cultivating codeless contributors
 
A golden era for Open Access or a trend towards the golden road to Open Access?
A golden era for Open Access or a trend towards the golden road to Open Access?A golden era for Open Access or a trend towards the golden road to Open Access?
A golden era for Open Access or a trend towards the golden road to Open Access?
 
Open APC Data in Germany - A Contribution to Open Access Monitoring
Open APC Data in Germany - A Contribution to Open Access MonitoringOpen APC Data in Germany - A Contribution to Open Access Monitoring
Open APC Data in Germany - A Contribution to Open Access Monitoring
 
Hackathon
HackathonHackathon
Hackathon
 
курсова робота
курсова роботакурсова робота
курсова робота
 

Último

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Keeping your cucumber suite maintainable

  • 2.
  • 3.
  • 4. Cucumber is meant to provide stakeholders a way to express specifications in plain english. All team members can be on the same page about the specifications. Also since this is automated, you effectively have executable specifications. Cucumber consists of feature files which has scenarios in given, when then statements and corresponding implementation of those in step_definition files.
  • 5. Scenario: Purchasing books online Given I have selected following books in my shopping cart: |title | price| |Sherlock Homes |12.35 | |Little Women |5.00 | When I proceed to checkout And I fill out the billing and shipping details And I give my credit card details Then I should see the order confirmation message
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. We will look at a sample scenario and try and analyse what’s wrong in the way it is written
  • 12. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page“ When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 13. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” with price “50$” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 14. Step rewritten: Given following products are available: |product title| price | |Kindle | 50.00 | |ipad | 50.00 | And product “ipad” is available with following options: |product option|product option value| | colour | white | And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 15. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” with price “50$” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 16. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Step rewritten: And I add the following to my shopping cart: |product name|product option|option value|quantity| | kindle | color | white | 2 | | ipad | | | 2 | And I have a product “Kindle” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 17. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” with price “50$” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 18. filling in billing and shipping details. Step rewritten: When I view the shopping cart When /^I view the shopping cart$/ do with_scope(Sections::MAP[“header”]) do click_link(“Shopping Cart”) end end And I have a product “Kindle” in products list And product “ipad" exists with color “white” e.g. sections. rb And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. module Sections When I click on view shopping cart within “//div[@id=header]” And I wait “10" MAP = Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" { When I fill in “First Name” with “John” „header' => And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” '//div[@id=„header‟]„ And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries } And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” end And I press “Next” Then I should see my shipping details on the order confirmation page
  • 19. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” with price “50$” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 20. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by When I view the shopping cart When /^I view the shopping cart$/ do with_scope(sections[“header”]) do click_link(“Shopping Cart”) end And %{wait for element to appear sections[„cart‟]”} End When /^wait for element to appear "([^"]*)"$/ do |selector| loop_until { find(:xpath, selector).visible? } end And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 21. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 22. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 23. Step rewritten: When I fill in my billing details And I choose to keep shipping address same as billing When /^I fill in my billing details$/ do fill_in(“first_name”, :with => “John”) fill_in(“last_name”, :with => “Doe”) fill_in(“email”, :with => “jdoe@gmail.com”) fill_in(“address”, :with => “Chicago, IL”) fill_in(“zipcode”, :with => “John”) select(“US”, :from => “Country”) End When /^I choose to keep shipping address same as billing$/ do check(“shipping_same_as_billing”) End And I fill in “Address” with “Chicago, IL” And I press “Next”
  • 24. Step rewritten: When I fill in my billing details And I choose to keep shipping address same as billing When /^I fill in my billing details$/ do fill_in(“first_name”, :with => “John”) fill_in(“last_name”, :with => “Doe”) fill_in(“email”, :with => “jdoe@gmail.com”) fill_in(“address”, :with => “Chicago, IL”) fill_in(“zipcode”, :with => “John”) select(“US”, :from => “Country”) End When /^I choose to keep shipping address same as billing$/ do check(“shipping_same_as_billing”) End And I fill in “Address” with “Chicago, IL” And I press “Next”
  • 25. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email “jdoe@gmail.com” And I have a product “Kindle” with price “50$” in products list And product “ipad" exists with color “white” And I have added 2 “Kindle” and 2 “ipad” with color “white” in my shopping cart. When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com” And I fill in “Address” with “Chicago, IL” And I select “US” from “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next” Then I should see my shipping details on the order confirmation page
  • 26. Then I should see my shipping details on the order confirmation page When I press "//span[@id='proceed_to_checkout']" button Then /^I should see my shipping details on the order confirmation page$/ do shipping_details = @user.shipping_address [:fist_name, :email, :zipcode].each do |field| Then %{I should see “#{shipping_details[field]}”} end om “Country” Then the countries list should show all countries This step depends on And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” an instance variable And I press “Next” being populated from some previous step
  • 27. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Given I have a user "john“ with last name “doe” and email jdoe@gmail.com When I click on view shopping cart within “//div[@id=header]” And I wait “10" Then I should see "Kindle" and “ipad" in the view shopping cart overlay Then I should see my shipping details on the order confirmation page When I press "//span[@id='proceed_to_checkout']" button Then I see the page title as "Billing Page" When I fill in “First Name” with “John” And I fill in “Last Name” with “Doe” And I fill in “Email” with “jdoe@gmail.com Then /^I should see my shipping details on the order confirmation page$/ do shipping_details = @user.shipping_address [:fist_name, :email, :zipcode].each do |field| Then %{I should see “#{shipping_details[field]}”} end om “Country” Then the countries list should show all countries And I fill in “Zipcode” with “60601” When I check “shipping_same_as_billing” And I press “Next”
  • 28. Scenario: User should be able to verify items in his shopping cart and proceed to checkout by filling in billing and shipping details. Then I should see shipping details for user “john” on the order confirmation page Then /^I should see shipping details for user “(.*)” on the order confirmation page$/ do |identifier| user = User.find_by_identifier(identifier) shipping_details = user.shipping_address [:fist_name, :email, :zipcode].each do |field| Then %{I should see “#{shipping_details[field]}”} end Send in unique Then the countries list should show socountries the identifiers all that And I select “US” from “Country” And I fill in “Zipcode” with “60601” specific record can be When I check “shipping_same_as_billing” And I press “Next” retrieved and testing can Then I should see my shipping details on the order confirmation page be done
  • 29. Given I have a user with details as: |first name| John | |last name | Doe | |email | jdoe@gmail.com| Given following products are available: |product title| price | |Kindle | 50.00 | |ipad | 50.00 | And product “ipad” is available with following options: |product option|product option value| | colour | white | And I add the following to my shopping cart: |product title|product option|option value| quantity | | kindle | color | white | 2 | | ipad | | | 2 | When I view the shopping cart Then I should see the following items in “Cart” section: | product |quantity| |kindle |2 | | ipad |1 | When I proceed to checkout When I fill in my billing details And I choose to keep shipping address same as billing And I submit the billing form Then I should see shipping details for user “john” on the order confirmation page
  • 30.
  • 31. Use the rerun profile feature (with caution!) rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" %> rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
  • 32.
  • 33. Backdoor entry for login: Quite often end to end scenarios consist of a user getting logged in and then doing things on the app. You need not repeat the complicated login process (via the ui). Simply get the user logged in the fastest way via a backdoor entry. Saves a lot of time !! Cut down 5 mins in a feature file.
  • 34. Backdoor entry for login: Without backdoor With backdoor When /^I log in as "([^"]*)" Given /^I am logged in as with password "([^"]*)" without "(.*)"$/ do |screen_name| overlay$/ do |email, password| url = When %{I go to the login page} "/backdoor/#{screen_name}“ When %{authenticate user call to visit url cis is stubbed to return end "<user><id>1</id></user>"} When %{search user call to cis is stubbed to return "<user><id>1</id></user>"} When %{I fill in "email" with "#{email}"} When %{I fill in "password" with "#{password}"} When %{I press "login"} And %{I wait "1"} @logged_in_user = User.find_by_email(email) end
  • 35. if Rails.env.test? get "/backdoor/:screen_name", :to => "sessions#backdoor", :as => "backdoor“ end def backdoor user = User.find_by_screen_name(params[:screen_na me]) set_current_user(user) head :ok end
  • 36. Do not use page.has_xpath? should be false. Go for page.should_not have_xpath. Has_xpath? would try repeatedly (till capybara timeout) to find the element. When it doesn’t find it, the value returned would be false which would match with the assert. Rather than that use has_no_xpath? So then capybara exits the first time itself when it does not find the element. Will save a lot of time!!! Cut down build time by 7 mins for us!
  • 37. Use scenario outlines with caution Scenario outlines should be used only if you actually need the whole scenario to be repeated for your examples not otherwise.
  • 38.
  • 39.
  • 40. When /^I fill in my billing details$/ do And %{I fill in “first_name” with “John”} And %{I fill in “zipcode” with “John”} And %{I select “US” from “Country”} End When /^I fill in my billing details$/ do fill_in(“first_name”, :with => “John”) fill_in(“zipcode”, :with => “John”) select(“US”, :from => “Country”) End Rather than dealing with regex matches deal with capybara methods which are equally readable. Introduce methods, modules, and keep your code dry and clean.
  • 41. Stop doing Start doing
  • 43. http://benmabey.com/2008/05/19/imperative-vs-declarative- scenarios-in-user-stories.html  http://elabs.se/blog/15-you-re-cuking-it-wrong  mislav.uniqpath.com/2010/09/cuking-it-right/  http://aslakhellesoy.com/post/11055981222/the-training-wheels- came-off  http://skillsmatter.com/podcast/home/refuctoring-your-cukes

Notas do Editor

  1. Introduce yourselves
  2. Some knowledge of cucumber
  3. When I started the Cucumber project in 2008 I had three major goals:Help stakeholders express what they want via executable specificationsHelp programmers write better software by making TDD/BDD easyReduce misinterpretations through a ubiquitous language
  4. When I started the Cucumber project in 2008 I had three major goals:Help stakeholders express what they want via executable specificationsHelp programmers write better software by making TDD/BDD easyReduce misinterpretations through a ubiquitous language
  5. small changes causing lot of cukes to failfailures causing long build timesSo much so that you seem to land up spending more time on the cukes rather than on the implementation
  6. small changes causing lot of cukes to failfailures causing long build timesSo much so that you seem to land up spending more time on the cukes rather than on the implementation
  7. Steps in different filesRedundant codeLess predictability
  8. Steps in wrong filesOrganized readableFlexible
  9. Dependencyoverriding
  10. Dependencyoverriding
  11. you can then specify the output location for your failures. And then run the failures in rerun profile. “A test is non-deterministic when it passes sometimes and fails sometimes, without any noticeable change in the code, tests, or environment. Such tests fail, then you re-run them and they pass. Test failures for such tests are seemingly random.” - Martin Fowler
  12. you can then specify the output location for your failures. And then run the failures in rerun profile. “A test is non-deterministic when it passes sometimes and fails sometimes, without any noticeable change in the code, tests, or environment. Such tests fail, then you re-run them and they pass. Test failures for such tests are seemingly random.” - Martin Fowler
  13. 21 mins to 17 mins
  14. 21 mins to 17 mins
  15. Reduced time for one feature from 7.5 minutes to 2.4 minutes
  16. Reduced time for one feature from 7.5 minutes to 2.4 minutes
  17. Parallel_tests, hydra, tlb
  18. Use more of Capybara DSL than web_stepsUse of CSS locator strategy than xpathConsistency set of guidelines for teamUse proper taggingStub out third party services calls and have seperate integration testsTreat cucumber scenarios like your unit tests code.