SlideShare a Scribd company logo
1 of 42
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
          """
# features/context/FeatureContext.php
<?php

use BehatBehatContextBehatContext;

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

    //....
}
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);
    }
}
One more thing
It is not a silver bullet
chitectural
        re ar
O ne mo
          level


Need dictionary


Requir
      e extre
   isolatio   me
            n
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

What's hot

Converting your JS library to a jQuery plugin
Converting your JS library to a jQuery pluginConverting your JS library to a jQuery plugin
Converting your JS library to a jQuery plugin
thehoagie
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
tonyh1
 
2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - php
Hung-yu Lin
 
Perl courseparti
Perl coursepartiPerl courseparti
Perl courseparti
ernlow
 

What's hot (17)

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

Viewers also liked

Innovaciones tecnológicas
Innovaciones tecnológicasInnovaciones tecnológicas
Innovaciones tecnológicas
Abi Gr
 

Viewers also liked (19)

Innovaciones tecnológicas
Innovaciones tecnológicasInnovaciones tecnológicas
Innovaciones tecnológicas
 
3 dicas para garantir uma estadia segura no Airbnb
3 dicas para garantir uma estadia segura no Airbnb3 dicas para garantir uma estadia segura no Airbnb
3 dicas para garantir uma estadia segura no Airbnb
 
Abstracción actividades en los espacios urbanos
Abstracción actividades en los espacios urbanos Abstracción actividades en los espacios urbanos
Abstracción actividades en los espacios urbanos
 
CpaExchange_Target@Mail.ru_саша
CpaExchange_Target@Mail.ru_сашаCpaExchange_Target@Mail.ru_саша
CpaExchange_Target@Mail.ru_саша
 
Refuerzo lenguaje
Refuerzo lenguajeRefuerzo lenguaje
Refuerzo lenguaje
 
Taller artistica john jairo
Taller artistica john jairoTaller artistica john jairo
Taller artistica john jairo
 
Zubed Geospatial
Zubed GeospatialZubed Geospatial
Zubed Geospatial
 
Nivelación 9°
Nivelación 9°Nivelación 9°
Nivelación 9°
 
Taller matematicas 8 carlos
Taller matematicas 8 carlosTaller matematicas 8 carlos
Taller matematicas 8 carlos
 
Web Developer Resume Sample
Web Developer Resume SampleWeb Developer Resume Sample
Web Developer Resume Sample
 
Refuerzo ciencias naturales
Refuerzo ciencias naturalesRefuerzo ciencias naturales
Refuerzo ciencias naturales
 
Young Marketers Elite 3_Assignment 21.1_Mobile Marketing
Young Marketers Elite 3_Assignment 21.1_Mobile MarketingYoung Marketers Elite 3_Assignment 21.1_Mobile Marketing
Young Marketers Elite 3_Assignment 21.1_Mobile Marketing
 
Cpa ex киб+риф_120416
Cpa ex киб+риф_120416Cpa ex киб+риф_120416
Cpa ex киб+риф_120416
 
Certificados Curso Locución Acta 23
Certificados Curso Locución Acta 23Certificados Curso Locución Acta 23
Certificados Curso Locución Acta 23
 
Certificados Locutor Acta 5
Certificados Locutor Acta 5Certificados Locutor Acta 5
Certificados Locutor Acta 5
 
Row-level security and Dynamic Data Masking
Row-level security and Dynamic Data MaskingRow-level security and Dynamic Data Masking
Row-level security and Dynamic Data Masking
 
Conflitos
ConflitosConflitos
Conflitos
 
使用 Serverless 技術打造支援 Alexa 的物聯網服務
使用 Serverless 技術打造支援 Alexa 的物聯網服務使用 Serverless 技術打造支援 Alexa 的物聯網服務
使用 Serverless 技術打造支援 Alexa 的物聯網服務
 
State of mobile apps in Vietnam Q1/2015
State of mobile apps in Vietnam Q1/2015State of mobile apps in Vietnam Q1/2015
State of mobile apps in Vietnam Q1/2015
 

Similar to BDT on PHP

Similar to BDT on PHP (20)

PHP Introduction and Training Material
PHP Introduction and Training MaterialPHP Introduction and Training Material
PHP Introduction and Training Material
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Php mysql training-in-mumbai
Php mysql training-in-mumbaiPhp mysql training-in-mumbai
Php mysql training-in-mumbai
 
Learning of Php and My SQL Tutorial | For Beginners
Learning of Php and My SQL Tutorial | For BeginnersLearning of Php and My SQL Tutorial | For Beginners
Learning of Php and My SQL Tutorial | For Beginners
 
Php My SQL Tutorial | beginning
Php My SQL Tutorial | beginningPhp My SQL Tutorial | beginning
Php My SQL Tutorial | beginning
 
Prersentation
PrersentationPrersentation
Prersentation
 
Introduction to php basics
Introduction to php   basicsIntroduction to php   basics
Introduction to php basics
 
WordPress Plugin Localization
WordPress Plugin LocalizationWordPress Plugin Localization
WordPress Plugin Localization
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php Crash Course - Macq Electronique 2010
Php Crash Course - Macq Electronique 2010Php Crash Course - Macq Electronique 2010
Php Crash Course - Macq Electronique 2010
 
Php introduction
Php introductionPhp introduction
Php introduction
 
PowerShell 101
PowerShell 101PowerShell 101
PowerShell 101
 
Lecture8
Lecture8Lecture8
Lecture8
 
Ch1(introduction to php)
Ch1(introduction to php)Ch1(introduction to php)
Ch1(introduction to php)
 
Php Vs Phyton
Php Vs PhytonPhp Vs Phyton
Php Vs Phyton
 
Drupaljam xl 2019 presentation multilingualism makes better programmers
Drupaljam xl 2019 presentation   multilingualism makes better programmersDrupaljam xl 2019 presentation   multilingualism makes better programmers
Drupaljam xl 2019 presentation multilingualism makes better programmers
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 

More from Oleksii Zozulenko (8)

First Steps in Performance
First Steps in PerformanceFirst Steps in Performance
First Steps in Performance
 
Bdd test frameworkphilosophy
Bdd test frameworkphilosophyBdd test frameworkphilosophy
Bdd test frameworkphilosophy
 
Automation failure
Automation failureAutomation failure
Automation failure
 
Prevent deadlockswithj meter
Prevent deadlockswithj meterPrevent deadlockswithj meter
Prevent deadlockswithj meter
 
Performance with Selenium2
Performance with Selenium2Performance with Selenium2
Performance with Selenium2
 
Goals Based Testing
Goals Based TestingGoals Based Testing
Goals Based Testing
 
Performance with jmeter
Performance with jmeterPerformance with jmeter
Performance with jmeter
 
Parallelization of tests with SeleniuGrid
Parallelization of tests with SeleniuGridParallelization of tests with SeleniuGrid
Parallelization of tests with SeleniuGrid
 

Recently uploaded

Recently uploaded (20)

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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 
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
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 

BDT on PHP

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n