Игры с огнём: знакомимся с bdd и cucumber фреймворком bddfire

Download Игры с огнём: знакомимся с BDD и Cucumber фреймворком BDDfire

Post on 16-Apr-2017




0 download

Embed Size (px)


  • Software quality assurance days19 sqadays.com

    -. 2021 2016

    Intellectsoft. ,

    : BDD Cucumber BDDfire

  • QA- Intellectsoft >2 , ()

    ISTQB Foundation level


  • BDD is like Jazz.

    There is no authoritative definition of what it is

  • BDD is a process designed to aid

    the management and the delivery of software development projects

    by improving communication between engineers and business


  • w o r k s h o p


  • 1.



  • 2.=> Cucumber format



  • 3.


    => step definitions

  • 3. => tests execution

  • - prevent the bug

    To do list:

  • - exhaustive list of scenarios

    To do list:

  • Whats to avoid?

  • Whats to avoid?- Leaking scenarios

    Given When Then

    A BX

  • Whats to avoid?- All is end-to-end

  • Whats to avoid?- Fixtures

  • BDD is not:

    Equal to Functional testing

  • BDD is not:

    Only about testing

  • a quick fix,...

    BDD is not:

  • ...an investment

    BDD is:

  • SQA DAys-18 talk: Behat-trick:...

  • w e b d r i v e r

  • bddfire:

    Write your tests, not framework

  • Why Cucumber?

  • bddfire:

    CapybaraSelenium WebdriverDockerRestClientPoltergeistGatlingAppiumSaucelabsRelish, YardAxe accessibility engineRubocop

  • Installation:

    $ gem install bddfire

    $ bddfire fire_cucumber

    $ cd cucumber & bundle install

  • Predefined steps:

    Given I am on url

    When I click on element having text foo"

    Then The page title is bar"

  • Predefined steps definitions:Then(/^page contains "(.*?)"$/) do |element| page.should have_css(element)end

    Then(/^I should see "(.*?)"$/) do |text| page.should have_content textend

  • Scenario: Signing in as an existing user

    Given I am on "http://test.org/auth"

    When I fill in "email" with the text "vlad@r.by"

    And I fill in "password" with the text "qwerty"

    And I click on element having text "Sign In"

    Then The page title is "Homepage"

    Hello world scenario:

  • Natural risks

    forest fire


    Project overview:Actions Rescue peoplePut out the fire

    Warn alpinists

    Budget 1000 2000


    50 5000

  • 1. Features

    Project structure:

    Scenario: I can see the quantity of risks in each state

    Given I'm a rescue team member

    When I observe the table of risks

    Then I see the correct quantity of risks by state

  • Project structure:

    When (/^I want to view the details of a Risk/) do risk_num = rand(1...10).to_s link = '#/steps/' + risk_num + '/details' find(:xpath,"(//*[@href='#{link}'])[1]").clickend

    2. Step definitions

  • Project structure:

    Capybara.configure do |config| config.run_server = false

    ... config.default_selector = :xpath config.default_wait_time = 60end

    3. Support code

  • Project structure:

    After dopage.evaluate_script('window.confirm = function()

    { return true; }')find(:xpath, '//*[@ng-click="vm.logOut()"]').click


    4. Hooks

  • Project structure:

    default: -p seleniumhtml: --format --out reports/test.htmlapi : DRIVER=poltergeist --tags @apichrome: DRIVER=chromepretty: -f pretty

    5. Configuration file

  • Project structure:

    source 'http://rubygems.org'gem 'cucumber'gem 'capybara'gem 'bddfire'gem 'selenium-webdriver'

    6. Dependencies

  • Project structure:6. Reports / Docs folders

  • Whats included?1. Capybara

    Acceptance test framework for web applications.

    It simulates how a real user would interact with the app

  • Why Capybara?

  • Why Capybara?Webrat => Capybara

  • Whats included?1. Capybara

    Given(/^I am on homepage$/) do visit('http://risk.piemont.org/#/login')end

    Given(/^I want to see Risk timeline/) do find(:xpath,'//*[@ui-sref="risk.timeline"]').clickend

  • Whats included?2. Poltergeist

    allows runNing Capybara tests on a headless browser

  • Whats included?2. Poltergeist

    @poltergeistScenario: Signing in as an existing user

    Given I am on "http://test.org/auth"When I fill in "email" with the text "vlad@r.by"And I fill in "password" with the text "qwerty"And I click on element having text "Sign In"Then The page title is "Homepage"

  • Whats included?3. parallel_tests

  • Whats included?4. BrowserStack

    Cloud-based cross-browser testing tool

  • Whats included?4. BrowserStack

  • Whats included?5. Rubocop

    Code style checker based on the community-driven Style Guide

  • Whats included?5. Rubocop

  • Whats included?6. CukeSniffer

    Static analysis tool for the Cucumber.

  • Whats included?6. CukeSniffer

  • Whats included?7. Yard

    A Requirements Documentation Tool

  • Whats included?7. Yard

  • Whats included?8. RestClient

    Simple HTTP and REST client for Ruby

  • Whats included?8. RestClient

    Given I send a GET request for ""

    Given I send a GET/PUT/POST/DELETE request for "" with the following: """


    Then the response should be JSON

  • Whats included?9. Axe

  • Whats included?9. Axe

  • Whats included?10. Gatling

    load testing framework

  • Whats included?10. Gatling

  • Whats included?11. Docker

    platform for distributed applications

  • Summary:

    $ gem install bddfire

    $ bddfire fire_cucumber

    $ cd cucumber & bundle install

  • Thanks!




View more >