2_cucumber
Upcoming SlideShare
Loading in...5
×
 

2_cucumber

on

  • 799 views

Cucumber

Cucumber

Statistics

Views

Total Views
799
Views on SlideShare
799
Embed Views
0

Actions

Likes
0
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

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

    2_cucumber 2_cucumber Presentation Transcript

    •  
    •  
      • Разработка с использованием Cucumber состоит из 3-х основных этапов.
        • Описание фич проекта простым человеческим языком. И даже необязательно английским.
        • Определение поступков (step definition) на Ruby
        • Цикл разработки: проверка фич кукумбером и реализация не прошедших тестирование фич ручками.
    •   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
    •  
    • Пример ошибки при выполнении
      • Возникшие у нас проблемы:
      •  
        • Selenium не видит новых дочерних окон
        • Скрытые поля
        • Капча
        • Не семантическая верстка
      • Подключаемые библиотеки:
      •  
        • Capybara
        • Faker
        • brominet
        • bermuda
        • ... их много...
    • Непрерывное системное тестирование   integrity + cucumber + selenium на VPS
    • The RSpec Book
    • Спасибо за внимание =)