Some basic CLI web performance tools

There is a nice set of CLI tools to enable you to run quick performance tests, and provide anlysis of css,html and javascript. The beauty of these command line utilities, is it makes it easy to integrate into a Gherkin function (post coming soon on this). The first tool combination is confessJS, which when used with phantomJS, provides a detailed list of network traffic and statistics:- Continue reading

Firefox v32 issues with Selenium WebDriver (Linux)

Firefox 32 does not work with Selenium WebDriver, and if you use Ubuntu and have upgraded recently, this is version you will probably have.  You will have seen some kind of error message from selenium, complaining about being unable to bind to the port firefox driver uses. To get round this annoyance, and as Ubuntu dont make it easy to downgrade Firefox version, I used following steps:-

  • sudo apt-get remove firefox
  • Download binary version of your choice (I used version 31)
  • Extract to location of you choice
  • Create link: ln -s /path/to/your/firefox/folder/firefox /usr/bin/firefox

Now Selenium and Firefox will play nicely ­čÖé

Behat And Testing Design Errors/Changes

Comparing screenshots can prove effective way to verify design errors/changes, using CasperJS in conjunction with Resemblejs makes comparisons and reporting easy. PhantomCSS does exactly this, and the repo is available here. Or you can take my forked version here, in which I removed the PhantomJS junk, and altered scripts to just process the screenshots directory. It was only the comparison tools I was looking for .

The trick is now to generate the screenshots (the baseline, and the one for comparison).

As I use Behat/Mink, I didnt need most of the PhantomCSS repo, which assumes use of phantonJS are test driver.

I generate screnshots after certain steps to create baseline for comparison (best to do this in context of a test suite).

* @Then /^I take a screenshot of current page “([^”]*)”$/
public function takeAScreenshotOfCurrentPage($pagename) {
$image_data = $this->getSession()->getDriver()->getScreenshot();
file_put_contents(‘PhantomCSS/screenshots/behat_’.$pagename.’.diff.png’, $image_data);

Then I use PhantomCSS to do the screenhot comparison grunt work. There is a manual step, which which you establish the baseline screenshots. Then each subsequent test run, a new “diff” file is generated and comapred with baseline version. If differences, then an almalgamated image is generated to highlight difference (filename appended with “fail”).


  • brew install casperjs
  • (or) npm install -g casperjs
  • Clone repo
  • Assuming you follow my behat route ..
  • Run your test once to get baseline images for pages.
  • Rename files by removing the “.diff” part
  • Each time test runs, the newer comparison file will be removed and updated.
  • The command to do comparison is:- casperjs test demo/testsuite.js

 Rudimentary end to end process (todo: add verification step function, and call the casperjs command from within Behat function)

Upgrade to php 5.5 on mac OS

Save yourself some plain, and run the following 3 command lines to upgrade to php 5.5 (or later version) on (bad, very very bad) MAC OS.

$ curl -s | bash -s 5.5
$ export PATH=/usr/local/php5/bin:$PATH
$ php -v