Behat

Behat Mink: 05 - regions in behat.yml

 

 

behat.yml

  • added region_map: footer: "#footer"
default:
  suites:
    default:
      contexts:
      - FeatureContext
      - Drupal\DrupalExtension\Context\DrupalContext
      - Drupal\DrupalExtension\Context\MinkContext
      - Drupal\DrupalExtension\Context\MessageContext
      - Drupal\DrupalExtension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      base_url: http://unityconstruct.org/uc/
    Drupal\DrupalExtension:
      blackbox: ~
      region_map:
        footer: "#footer"

 

 

 

Behat Mink: 03 - First working

cmder session with passing results

  •  
T:\git\behatmink
λ bin\behat
Feature: Product basket
  In order to buy products
  As a customer
  I need to be able to put interesting products into a basket

  Rules:
  - VAT is 20%
  - Delivery for basket under $10 is $3
  - Delivery for basket over $10 is $2

  Scenario: Buying a single product under $10               # features\basket.feature:11
    Given there is a "Sith Lord Lightsaber", which costs $5 # FeatureContent::thereIsAWhichCosts()
    When I add the "Sith Lord Lightsaber" to the basket     # FeatureContent::iAddTheToTheBasket()
    Then I should have 1 product in the basket              # FeatureContent::iShouldHaveProductInTheBasket()
    And the overall basket price should be $9               # FeatureContent::theOverallBasketPriceShouldBe()

  Scenario: Buying a single product over $10                 # features\basket.feature:17
    Given there is a "Sith Lord Lightsaber", which costs $15 # Featu

Behat Mink: 02 - Drupal Extension(& Mink ) Framework (Inital State)

Behat Quick Start

 

Comoposer.json

{
  "require":{
      "drupal/drupal-extension":"~3.0",
      "guzzlehttp/guzzle" : "^6.0@dev"
    },
      "config":{
        "bin-dir":"bin/"
      }
}
    

Behat.yml

default:
  suites:
    default:
      contexts:
       - FeatureContent
       - Drupal\Extension\Context\DrupalContext
       - Drupal\Extension\Context\MinkContext
       - Drupal\Extension\Context\MessageContext
       - Drupal\Extension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      base_url: http://unityconstruct.org
    Drupal\DrupalExtension:
      blackbox: ~

 

Get Composer & Compile

 

Behat Mink: 00 - Considerations

  • must be ran on same server drupal is built/deployed on
    • NOT good for production deployment/testing
  • Actually really bad period
    • this tightly binds the testing product with the website product
    • can't target multiple environments from a test drone/vm
    •  

 

Tags
Subscribe to Behat