PHP

Behat Mink: Drush Driver Compser Install

Drush Installation

https://github.com/drush-ops/drush

 

Via Composer with composer.json

composer require drush-ops/behat-drush-endpoint:^1

 

T:\git\behatmink (master -> origin)
λ php composer.phar require drush-ops/behat-drush-endpoint:^1
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing composer/installers (v1.6.0): Downloading (100%)
  - Installing drush-ops/behat-drush-endpoint (1.0.0): Downloading (100%)
Writing lock file
Generating autoload files

 

Tags

Behat Mink: Namespaces & Behat.yml Context Assignments

  • If namespaces are used, the php files MUST reside in the matching path for the namespace
  • For Behat... this path starts at the 'bootstrap' path specified in behat.yml

 

 

default:
  autoload:
    - "%paths.base%/bootstrap"
  suites:
    default:
      paths:
        features: '%paths.base%/../features/dev'
      contexts:
      - FeatureContext
      - Drupal\DrupalExtension\Context\DrupalContext
      - Drupal\DrupalExtension\Context\MinkContext
      - Drupal\DrupalExtension\Context\MessageContext
      - Drupal\DrupalExtension\Context\DrushContext

 

 

Tags

Behat Mink: MinkExtension

https://github.com/Behat/MinkExtension/blob/master/doc/index.rst

 

Mink Extension

You can use Behat to describe anything, that you can describe in business logic. It’s tools, gui applications, web applications. The most interesting part is web applications. First, behavioral testing already exists in the web world - it’s called functional or acceptance testing. Almost all popular frameworks and languages provide functional testing tools. Today we’ll talk about how to use Behat for functional testing of web applications. Mink is a tool exactly for that and this extension provides integration for it.

Basically, MinkExtension is an integration layer between Behat 3.0+ and Mink 1.4+ and it provides:

Tags

Behat Mink: 10 - DrupalExtension Drupal API Driver

 

Drupal API Driver

The Drupal API Driver is the fastest and the most powerful of the three drivers. Its biggest limitation is that the tests must run on the same server as the Drupal site.

Enable the Drupal API Driver

To enable the Drupal API driver, edit the behat.yml file, change the api_driver to drupal and add the path to the local Drupal installation as shown below:

Tags

Behat Mink: 00 - Selenium

Selenium

Download the latest version of Selenium Server It’s under the heading Selenium Server (formerly the Selenium RC Server). This is a single file which can be placed any where you like on your system and run with the following command:

java -jar selenium-server-standalone-2.44.0.jar &
// replace with the name of the version you downloaded

 

Behat Mink: 09 - CLI Options & BEHAT_PARAMS

bin\behat

  • -d, --dl, --definitions, -di,
    • MinkContext definitions list
      • -di = MinkContext def list info
      • -dl = MinkContext def list short
      • --definitions="field", -dfield
        • search definitions
  • --init
  • -c, --config
    • behat.yml file
  • -p, --profile
    • profile in the behat.yml file
  • --tags=
    • tags
  • --dry-run
  • --dry-run --addpend-snippets
  • --suite=
    • specific test suite(s)
  • -o, --out
    • report.txt
    • std = console
  • -f, --format
    • pretty
    • progress
  • --colors
  • --no-colors

 

Tags
Subscribe to PHP