Business Selectors
                Extension For



Thursday, 18 October 12
Ben Waine



Thursday, 18 October 12
BDD Workflow In Large Organisations


                             Business Analyst   Designers

                                 Tester

                                Developer

                                 Tester

                             Business Analyst

Thursday, 18 October 12
BDD Workflow In Large Organisations

                          Business Analyst     Designers



                                     Tester
 Concepts

 Implementation




                                   Developer

Thursday, 18 October 12
Example Steps Shipped With Mink Extension

          Scenario: Searching for a page that does exist
            Given I am on "/wiki/Main_Page"
            When I fill in "search" with "Behavior Driven Development"
            And I press "searchButton"
            Then I should see "agile software development"




     When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with "(?P<value>(?:[^"]|")*)"$/

     When /^(?:|I )press "(?P<button>(?:[^"]|")*)"$/




Thursday, 18 October 12
Problems Encountered At Sky / Orange

   • Mink requires implementation details
   • Test teams with no PHP skills
   • Difficulty identifying elements on the page using Mink
   Extension




Thursday, 18 October 12
Business Selectors



Thursday, 18 October 12
Example
            test.feature
            Given I go to the page "Home Page"
            When I follow the link "Add Subscription"
            And I fill in the "first name box" field with "ben"
            Then the "first name box" form field should contain "ben"
            And I press the "test" button
            And the "Widget" should contain "Area One Text"

           selectors.yml

            Add Subscription: "a.self-link"
            first name box: "form#name_form
            input[name=first_name]"
            test: "form#name_form input[name=submit]"
            Widget: div#user_widget


           urls.yml
           Home Page: "/"
           Element Page: "/element.html"



Thursday, 18 October 12
Steps Shipped With Business Selector Extension
 Given I go to the page "<PAGE NAME>"
 When I follow the link "<LINK>"
 When I click the "<CLICKABLE ELEMENT>"
 When I press the "<BUTTON>" button
 When I fill in the "<TEXT INPUT>" field with "value"
 When the "<TEXT INPUT>" form field should not contain "value"
 When I select "value" from the "<SELECT OR MULTISELECT>" selector
 When I additionally select "value" from the "<MULTISELECT>" selector
 When I check the "<CHECKBOX>" checkbox
 When I uncheck the "<CHECKBOX>" checkbox
 When I focus on the "<IFRAME (RELATES TO ID OR INDEX)>" iframe
 When I refocus on the primary page
 When I hover over "<PAGE ELEMENT>"
 When I wait for the "<PAGE ELEMENT>" component to [dis]appear
 Then the "<PAGE ELEMENT>" should contain "value"
 Then the "<PAGE ELEMENT>" should not contain "value"
 Then I should see "<PAGE ELEMENT>" component
 Then I should not see "<PAGE ELEMENT>" component
 Then "<PAGE ELEMENT>" should contain "<PAGE ELEMENT>"
 Then "<PAGE ELEMENT>" should not contain "<PAGE ELEMENT>"
 Then the "<CHECKBOX>" should be checked
 Then the "<CHECKBOX>" should not be checked
 Then the "<TEXT INPUT>" form field should contain "value"
Thursday, 18 October 12
Some Extra Steps Dealing With Common Tasks
         When I focus on the "<IFRAME (RELATES TO ID OR INDEX)>" iframe
         When I refocus on the primary page

         Given I attach <FILEPATH> to <PAGEELEMENT>

         When I wait for the "<PAGE ELEMENT>" component to [dis]appear




Thursday, 18 October 12
Extension Configuration
    default:
        context:
             parameters:
                 javascript_session: selenium
                 browser: firefox
                 show_cmd: open %s
        extensions:
             OrangeDigitalBusinessSelectorExtensionExtension:
               urlFilePath: urls.yml
               selectorFilePath: selectors.yml
               assetPath: path
               timeout: 30
               contexts:
                 UIBusinessSelector: ~
             BehatMinkExtensionExtension:
                 base_url: "http://local.dev"
                 default_session: goutte
                 goutte: ~
                 selenium: ~
                 selenium2: ~

Thursday, 18 October 12
Extension Use

  <?php

  // Namespaces ...

  class FeatureContext extends BehatContext
  {
      public function __construct(array $parameters)
      {
          $this->useContext('mink', new MinkContext($parameters));
          $this->useContext('BS', new BusinessSelectorContext($parameters));
      }
  }




Thursday, 18 October 12
DEMO

Thursday, 18 October 12
BDD Workflow In Large Organisations

                          Business Analyst     Designers


                                                       Business
                                     Tester
 Concepts
                                                       Selectors
 Implementation




                                   Developer

Thursday, 18 October 12
BDD Workflow In Large Organisations


                             Business Analyst   Designers

                                 Tester

                                Developer

                                 Tester

                             Business Analyst

Thursday, 18 October 12
Questions?



Thursday, 18 October 12
Shameless Plug:
                Orange Digital Are Hiring!
                     Testers / Developers - Contract / Permanent

                              ray.fawcett@orange.com




Thursday, 18 October 12

Business selectors

  • 1.
    Business Selectors Extension For Thursday, 18 October 12
  • 2.
  • 3.
    BDD Workflow InLarge Organisations Business Analyst Designers Tester Developer Tester Business Analyst Thursday, 18 October 12
  • 4.
    BDD Workflow InLarge Organisations Business Analyst Designers Tester Concepts Implementation Developer Thursday, 18 October 12
  • 5.
    Example Steps ShippedWith Mink Extension Scenario: Searching for a page that does exist Given I am on "/wiki/Main_Page" When I fill in "search" with "Behavior Driven Development" And I press "searchButton" Then I should see "agile software development" When /^(?:|I )fill in "(?P<field>(?:[^"]|")*)" with "(?P<value>(?:[^"]|")*)"$/ When /^(?:|I )press "(?P<button>(?:[^"]|")*)"$/ Thursday, 18 October 12
  • 6.
    Problems Encountered AtSky / Orange • Mink requires implementation details • Test teams with no PHP skills • Difficulty identifying elements on the page using Mink Extension Thursday, 18 October 12
  • 7.
  • 8.
    Example test.feature Given I go to the page "Home Page" When I follow the link "Add Subscription" And I fill in the "first name box" field with "ben" Then the "first name box" form field should contain "ben" And I press the "test" button And the "Widget" should contain "Area One Text" selectors.yml Add Subscription: "a.self-link" first name box: "form#name_form input[name=first_name]" test: "form#name_form input[name=submit]" Widget: div#user_widget urls.yml Home Page: "/" Element Page: "/element.html" Thursday, 18 October 12
  • 9.
    Steps Shipped WithBusiness Selector Extension Given I go to the page "<PAGE NAME>" When I follow the link "<LINK>" When I click the "<CLICKABLE ELEMENT>" When I press the "<BUTTON>" button When I fill in the "<TEXT INPUT>" field with "value" When the "<TEXT INPUT>" form field should not contain "value" When I select "value" from the "<SELECT OR MULTISELECT>" selector When I additionally select "value" from the "<MULTISELECT>" selector When I check the "<CHECKBOX>" checkbox When I uncheck the "<CHECKBOX>" checkbox When I focus on the "<IFRAME (RELATES TO ID OR INDEX)>" iframe When I refocus on the primary page When I hover over "<PAGE ELEMENT>" When I wait for the "<PAGE ELEMENT>" component to [dis]appear Then the "<PAGE ELEMENT>" should contain "value" Then the "<PAGE ELEMENT>" should not contain "value" Then I should see "<PAGE ELEMENT>" component Then I should not see "<PAGE ELEMENT>" component Then "<PAGE ELEMENT>" should contain "<PAGE ELEMENT>" Then "<PAGE ELEMENT>" should not contain "<PAGE ELEMENT>" Then the "<CHECKBOX>" should be checked Then the "<CHECKBOX>" should not be checked Then the "<TEXT INPUT>" form field should contain "value" Thursday, 18 October 12
  • 10.
    Some Extra StepsDealing With Common Tasks When I focus on the "<IFRAME (RELATES TO ID OR INDEX)>" iframe When I refocus on the primary page Given I attach <FILEPATH> to <PAGEELEMENT> When I wait for the "<PAGE ELEMENT>" component to [dis]appear Thursday, 18 October 12
  • 11.
    Extension Configuration default: context: parameters: javascript_session: selenium browser: firefox show_cmd: open %s extensions: OrangeDigitalBusinessSelectorExtensionExtension: urlFilePath: urls.yml selectorFilePath: selectors.yml assetPath: path timeout: 30 contexts: UIBusinessSelector: ~ BehatMinkExtensionExtension: base_url: "http://local.dev" default_session: goutte goutte: ~ selenium: ~ selenium2: ~ Thursday, 18 October 12
  • 12.
    Extension Use <?php // Namespaces ... class FeatureContext extends BehatContext { public function __construct(array $parameters) { $this->useContext('mink', new MinkContext($parameters)); $this->useContext('BS', new BusinessSelectorContext($parameters)); } } Thursday, 18 October 12
  • 13.
  • 14.
    BDD Workflow InLarge Organisations Business Analyst Designers Business Tester Concepts Selectors Implementation Developer Thursday, 18 October 12
  • 15.
    BDD Workflow InLarge Organisations Business Analyst Designers Tester Developer Tester Business Analyst Thursday, 18 October 12
  • 16.
  • 17.
    Shameless Plug: Orange Digital Are Hiring! Testers / Developers - Contract / Permanent ray.fawcett@orange.com Thursday, 18 October 12