Currently Browsing

Posts Tagged ‘ Wordpress ’

Behat Mink default commands in Gherkin

The Gherkin language provide us with lot of ambiguous commands that help us write steps faster and code less.
Beside the default steps you can always add your own steps and write background code for additional re-usability and handling. More about this on later blog following the Behat BDD development.

To list out the default commands use command “bin/behat -dl” and you should get result like:

Behat test examples – BDD and PHP

Continuing on my previous post about setting up a Behat test environment on Windows 10 now we will create some tests to see how the setup is working. These are some basic tests, as we are learning together.For running test we need to create a “behat.yml” file which Behat use as configuration file by default. more about it on this link: http://docs.behat.org/en/v3.0/user_guide/configuration.html#behat-yml

You can also find some example files on the web.
My experimenting config file contains values sufficient for some first basic tests:

default:
  extensions:
    Behat\MinkExtension:
      base_url: 'http://wedoqa.com/'
      browser_name: chrome
      goutte: ~
      selenium2: ~
paths:
    features: features
    bootstrap: %behat.paths.features%/Context

This configuration will:
– use http://wedoqa.com/ as base page to load on start,
– run tests in chrome (if browser is required),
– use goutte and selenium2 basic configurations,
– setup paths for Features and FratureContext.

Behat (BDD) – Basics and Libraries

Hello dear Reader,

If you are interested learning a popular PHP test automation tool and working with it on windows, than this blog might help you out. In recent blog of mine about Behavior driven Development (BDD). I decided to make a series of Behat which is a BDD framework written in PHP language, which is rapidly increasing in its popularity in PHP, WordPress, Drupal end other communities. It is open source framework working on PHP 5.3+ versions.

Behat:

Allows writing clear and human readable tests as it is written in Gherkin (also mentioned in my previous blog) which is a business-readable domain specific language following defined patterns (usually Given-When-Then pattern of variation). Behat tests are written in plain English (or other 67 supported language) phrases which are then combined into human readable scenarios. The tests are understandable by almost anyone, whether you are person without any programming skills up to a full-time developer. Behat is the core of the framework and it is capable to test various system types such as REST APIs, terminal commands and headless testing, however for testing web pages we require controllers and emulators such as Mink, Goutte, Selenium and various web drivers for desired browsers.