Currently Browsing

Author Archive

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:

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

      base_url: ''
      browser_name: chrome
      goutte: ~
      selenium2: ~
    features: features
    bootstrap: %behat.paths.features%/Context

This configuration will:
– use 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.

How to install Behat on Windows 10

If you have decided to test with Behat and work on Windows OS, you will require some workaround as the official documentation is providing instructions for Unix/Mac installation only.

Maybe these instructions will be helpful to you.


(or WAMP respectively – here i will use XAMP)

  1. Download the XAMPP from the official site ttps://
  2. Choose version – for this purpose, I have chosen version 5.6.23 / PHP 5.6.23
  3. Install XAMPP
    * Select all defaults, the default install path “C:\xampp”, you can choose differently but here I leave that as is.
  4. Setup the PHP by your requirements i will leave that up to you.


Quick intro: Composer is a dependency manager for PHP inspired by the Node.js for Javascript. For more to read about you have documentation on the official site Get Composer Link. If you have time I highly recommend to you dear reader to look into its documentation for more information.

Link for the Windows installer of composer is
The installer will assum that you PHP is located in “C:\xampp\php” automatically. If you have changed that path, adjust it during the Composer installation as well.

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.


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.

Behavior-Driven Development (BDD)

BDD is a software development process evolved from TDD and we can say it is an extension of TDD. It uses domain-specific language (DSL) that we call natural or ubiquitous language to illustrate behaviors (how users will interact with the product or what are the expectations of business objectives with the product).

Navigating between browser windows with WD

I’ll continue more about testing with JavaScript WD test frame and Selenium stand-alone server.
Today’s topic is navigating between browser windows (or tabs) with WD.

The Webdriver sees each tab and window as a window, it doesn’t make difference. The difference is only at the browser how it is set to handle the windows appearance, opens them in separate browser or as tabs. With WD the navigation is pretty straight forward and not so difficult. There is a command called windowHandles() which as you can read handles the windows. Actually it returns a list of opened windows based on a generated ID by the browser. I’ll give some minor example about navigating and work between two windows.

Test Frameworks to work with inside NodeJS

Testing with NodeJS requires some test framework to work with inside NodeJS.

Our list would be something like this:

  • Mocha
  • Jasmine
  • QUnit
  • Express (no longer supported)
  • jsUnit
  • some other tools

Lets focus on the first three now in this section, they are the most widely used, with some pros and cons.

Webdriver using javascript expressions in Browser Console

Today I will write about javascript expressions executing in browser consoles during testsing. Sometimes you need to inject some javascript code into the web page, for additional testing, additional features or by client request.
In some cases a simple console.log() could do the trick, but sometimes it is not enough , especially when you use an already opened cmd.exe through which you run tests, because that way the console.log() will write in that console not into the browser’s.

Java Selenium Element Locations

Sometimes you need to test are the elements in place regarding to each other. Finding inner-child elements, to check do they overlap partially or totally each other.
Are they visible and dimensions regarding the display and so forth. It depends on what do you need, there are wide varieties for testing, from which I will cover the most used cases.

Is this quick tutorial I will cover three basic tests :

  1. Is one element inside the other
  2. Do elements have overlap of borders
  3. Are two elements apart from each others (outside one another with no overlap of borders)

Let see some code, I shall use Java program language with Selenium 2 Webdriver and testNG for unit testing.