SlideShare a Scribd company logo
Chernivtsi
Цель: Люди узнали,
                                  что перед ними не фейк,


Whoami
                                  а человек с опытом




         QA Team Lead


         !oacher automated-testing.info


         5+ years of experience
BDT on PHP
в марте 2006 года


Introduced by




              Dan North
       http://dannorth.net/introducing-bdd/
Test method names should be
         sentences
BDD provides a
“ubiquitous language”
     for analysis
Business Story
Business Story
Business Story



   I want casino with
      blackjack & ...
In order to have fun
            As User
    I push “Green” button
Then I get casino with blackjack
              & ...
Gherkin Syntax


In order to [some profit]
As a [user_role]
I need [some_functional]
Gherkin Syntax

Feature:
In order to [some profit]
As a [user_role]
I need [some_functional]

                           Scenario: As user I should...
                           Given [incomes]
                           When [action]
                           Then [result]
Your native language

    en           jp
    fr           da
    es           en-pirate
    it           ...
Specifications should run
RSpec      JSpec     Behat

Cucumber   JBehave   Fabulous
RSpec      JSpec     Behat
Cucumber   JBehave   Fabulous
Inspired by Cucumber

  Snippet examples

     Symfony 2
Features

  Output

Events & Tags
# features/ls.feature
Feature: ls
  In order to see the directory structure
  As a UNIX user
  I need to be able to list the current
directory's contents

      @ls @fe @tag2
      Scenario: List 2 files in a directory
        Given I am in a directory "test"
        And I have a file named "foo"
        And I have a file named "bar"
        When I run "ls"
        Then I should get:
          """
          bar
          foo
          """
BDT on PHP
BDT on PHP
# features/context/FeatureContext.php
<?php

use BehatBehatContextBehatContext;

class FeatureContext extends BehatContext {
    /**
      * @Given /^I run "([^"]*)"$/
      */
    public function iRun($command) {
         exec($command);
    }

    //....
}
BDT on PHP
What about web?
Mink




http://mink.behat.org
Drivers


     Headless   Browser

                  Sahi
      Goutte
                Selenium/
      Zombie
                WebDriver
Page Objects Pattern

$page = $this->getSession()->getPage();


$element = $page->find(‘xpath’, ‘locator’);


$element->click();
# features/context/FeatureContext.php
<?php

use BehatMinkContextMinkContext;

class FeatureContext extends MinkContext {
    /**
      * @Given /^I am "([^"]*)" user$/
      */
    public function iAmUser($username) {
        $this->getSession()->getPage()-
        >find(‘xpath’, ‘#username’)-
        >setValue($username);
    }
}
BDT on PHP
One more thing
It is not a silver bullet
chitectural
        re ar
O ne mo
          level


Need dictionary


Requir
      e extre
   isolatio   me
            n
BDT on PHP
hitectural
  ne more arc
O
         level



Need dictionary


Requir
      e extre
   isolatio   me
            n
Цель показать, что
                           языковые конструкции
                           имеют одинаковое
                           занчение, но пишутся по
                           разному




I am customer   I fill in “smth”
I am user       I fill into “smth”
Цель показать, что
                                   языковые конструкции
                                   имеют одинаковое
                                   занчение, но пишутся по
                                   разному




I am customer        I fill in “smth”
I am user            I fill into “smth”



 /^I am ?(user|customer)$/

 /^I fill ?(in|into) "([^"]*)"$/
Regexp hell

 (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?
 ^_`{|}~-]+)*|"(?:[x01-x08x0bx0cx0e-x1fx21x23-x5bx5d-
 x7f]|[x01-x09x0bx0cx0e-x7f])*")@(?:(?:[a-z0-9](?:[a-
 z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|[(?:(?:
 25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4]
 [0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[x01-
 x08x0bx0cx0e-x1fx21-x5ax53-x7f]|[x01-x09x0bx0cx0e-
 x7f])+)])
hitectural
   ne more arc
 O
          level



 Need dictionary


Requi
      re extr
              eme
   isolatio
            n
Steps to Reproduce

 Scenario: clicking on Edit button leads to customer edit page
 Given I am at "BECustomerList" page
 When I click on "Edit" for "user@example.com"
 Then I should get "BECustomerEdit" page of
"user@example.com"
   Actual: http://test.serv/admin/newsletters.php
   Expected: http://test.serv/admin/customers/1507/
   Failed asserting that <boolean:false> is true.
What we learnt?
What we learnt?


      Behavior      Feature


                 Gherkin
  Dan North
                           Acceptance

           Behat/Mink
BDT on PHP



Oleksii Zozulenko

ozozulenko@gmail.com

automated-testing.info

darktesting.blogspot.com

More Related Content

PDF
NodeJS The edge of Reason - Lille fp#6
PDF
003 scripting
ODP
PHP: The easiest language to learn.
PDF
WordPress: From Antispambot to Zeroize
PDF
PyFoursquare: Python Library for Foursquare
PDF
Lettering js
PDF
Your code sucks, let's fix it! - php|tek13
ODP
Caret Introduction
 
NodeJS The edge of Reason - Lille fp#6
003 scripting
PHP: The easiest language to learn.
WordPress: From Antispambot to Zeroize
PyFoursquare: Python Library for Foursquare
Lettering js
Your code sucks, let's fix it! - php|tek13
Caret Introduction
 

What's hot (17)

KEY
Intermediate PHP
PDF
Converting your JS library to a jQuery plugin
PDF
PhpSpec 2.0 ilustrated by examples
PPT
Php Tutorial | Introduction Demo | Basics
PDF
Data Types In PHP
PPTX
An introduction to javascript
PPTX
php (Hypertext Preprocessor)
KEY
Geek Moot '09 -- Smarty 101
ODP
OpenGurukul : Language : Shell Scripting
PDF
A Self Replicating Serverless Function
KEY
PHPSpec BDD for PHP
KEY
JavaScript Neednt Hurt - JavaBin talk
PDF
WordCamp Portland 2018: PHP for WordPress
PDF
2014 database - course 2 - php
PDF
PHPSpec - the only Design Tool you need - 4Developers
PDF
Forget about Index.php and build you applications around HTTP - PHPers Cracow
PPTX
Perl courseparti
Intermediate PHP
Converting your JS library to a jQuery plugin
PhpSpec 2.0 ilustrated by examples
Php Tutorial | Introduction Demo | Basics
Data Types In PHP
An introduction to javascript
php (Hypertext Preprocessor)
Geek Moot '09 -- Smarty 101
OpenGurukul : Language : Shell Scripting
A Self Replicating Serverless Function
PHPSpec BDD for PHP
JavaScript Neednt Hurt - JavaBin talk
WordCamp Portland 2018: PHP for WordPress
2014 database - course 2 - php
PHPSpec - the only Design Tool you need - 4Developers
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Perl courseparti
Ad

Viewers also liked (18)

PPTX
Innovaciones tecnológicas
PPTX
3 dicas para garantir uma estadia segura no Airbnb
PPTX
Abstracción actividades en los espacios urbanos
PPTX
CpaExchange_Target@Mail.ru_саша
PDF
PDF
Taller artistica john jairo
PPT
Zubed Geospatial
PDF
Taller matematicas 8 carlos
PDF
Web Developer Resume Sample
PDF
Refuerzo ciencias naturales
PDF
Young Marketers Elite 3_Assignment 21.1_Mobile Marketing
PPTX
Cpa ex киб+риф_120416
PDF
Certificados Curso Locución Acta 23
PDF
Certificados Locutor Acta 5
PPTX
Row-level security and Dynamic Data Masking
PPTX
Conflitos
PDF
State of mobile apps in Vietnam Q1/2015
Innovaciones tecnológicas
3 dicas para garantir uma estadia segura no Airbnb
Abstracción actividades en los espacios urbanos
CpaExchange_Target@Mail.ru_саша
Taller artistica john jairo
Zubed Geospatial
Taller matematicas 8 carlos
Web Developer Resume Sample
Refuerzo ciencias naturales
Young Marketers Elite 3_Assignment 21.1_Mobile Marketing
Cpa ex киб+риф_120416
Certificados Curso Locución Acta 23
Certificados Locutor Acta 5
Row-level security and Dynamic Data Masking
Conflitos
State of mobile apps in Vietnam Q1/2015
Ad

Similar to BDT on PHP (20)

PPTX
PHP Introduction and Training Material
PDF
Living With Legacy Code
PPT
Php mysql training-in-mumbai
PPT
Learning of Php and My SQL Tutorial | For Beginners
PDF
PHP Programming and its Applications workshop
PPT
Prersentation
PDF
WordPress Plugin Localization
PPT
slidesharenew1
PPT
My cool new Slideshow!
PPT
Php mysql
PPT
Php mysql
PDF
Php Crash Course - Macq Electronique 2010
PPTX
Unit 5-PHP Declaring variables, data types, array, string, operators, Expres...
PPT
Php introduction
PPTX
PowerShell 101
PDF
Lecture8
PPTX
Ch1(introduction to php)
PPTX
Php Vs Phyton
PHP Introduction and Training Material
Living With Legacy Code
Php mysql training-in-mumbai
Learning of Php and My SQL Tutorial | For Beginners
PHP Programming and its Applications workshop
Prersentation
WordPress Plugin Localization
slidesharenew1
My cool new Slideshow!
Php mysql
Php mysql
Php Crash Course - Macq Electronique 2010
Unit 5-PHP Declaring variables, data types, array, string, operators, Expres...
Php introduction
PowerShell 101
Lecture8
Ch1(introduction to php)
Php Vs Phyton

More from Oleksii Zozulenko (8)

PDF
First Steps in Performance
PDF
Bdd test frameworkphilosophy
KEY
Automation failure
KEY
Prevent deadlockswithj meter
PPT
Performance with Selenium2
PPTX
Goals Based Testing
PPT
Performance with jmeter
PPT
Parallelization of tests with SeleniuGrid
First Steps in Performance
Bdd test frameworkphilosophy
Automation failure
Prevent deadlockswithj meter
Performance with Selenium2
Goals Based Testing
Performance with jmeter
Parallelization of tests with SeleniuGrid

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Tartificialntelligence_presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Machine Learning_overview_presentation.pptx
PPT
Teaching material agriculture food technology
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Tartificialntelligence_presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Digital-Transformation-Roadmap-for-Companies.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Per capita expenditure prediction using model stacking based on satellite ima...
Machine Learning_overview_presentation.pptx
Teaching material agriculture food technology
OMC Textile Division Presentation 2021.pptx
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Univ-Connecticut-ChatGPT-Presentaion.pdf
A Presentation on Artificial Intelligence
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
A comparative study of natural language inference in Swahili using monolingua...

BDT on PHP

Editor's Notes