SW Designs

Technology and Photography

Behat, Selenium2 and SauceLabs

I’ll be honest, last time I used Selenium (1.x) the experience wasn’t great. The server component had serious stability issues and the IDE was clunky and slow to use. So it was with some trepidation that I revisited the project recently as I was looking for an automated, in-browser, cross-platform (inc. mobile) platform for automated web applications.

Introducing WebDriver

Since my initial Selenium experience there has been a new major release, Selenium 2. It uses the WebDriver API, relying on drivers to be supplied for individual browsers, with some being vendor supported. Current browser support includes Chrome, Firefox, Opera, Internet Explorer, Android and Safari on iOS. A marked improvement on Selenium 1!

Adding some Sauce

Here’s where it gets interesting, companies such as SauceLabs and TestingBot provide a SaaS-style Selenium Grid/Hub product, covering multiple OSes and browser combinations. TestingBot even has support for iOS and Android using their respective emulators, with SauceLabs planning to add support in late 2012.

Behat integration

For this example, I’ll be using the SauceLabs platform to run the MinkExtension-example tests. Follow the instructions in the README to get it running with Selenium running locally. Done? Let’s move on.

Open behat.yml.dist and add the following new profile, setting your own SauceLabs username and password details.

That’s it! Just re-run behat using your new profile.

bin/behat -p saucelabs

After that’s complete, you should have something like in your SauceLabs job history, http://bit.ly/BehatWebDriverSauceLabs

Gingerbread Man

When it comes to cameras, I’ve always been a point and shoot photographer. My Panasonic TZ7, with it’s 12x optical zoom has done me proud for several years now.

However, for some time I’ve wondered what I could achieve with and DSLR with their better lens, sensors and far greater options. So this year I asked Santa for a Cannon EOS 1100D with the upgraded 18-55mm IS lens. Here’s my first published photo.

Tuning PHP

Despite being introduced in PHP 5.1.0 that was released in late 2005, there are a pair of less well known php.ini directives that can have a noticeable affect on performance, especially for developers who work with spagetti code. These options control how PHP files are cached internally by PHP when using, for example, the include/require constructs (not functions!). These options are,


Determines the size of the realpath cache to be used by PHP. This value should be increased on systems where PHP opens many files, to reflect the quantity of the file operations performed.


Duration of time (in seconds) for which to cache realpath information for a given file or directory. For systems with rarely changing files, consider increasing the value.

So why should people care about these options? Well, everytime that a file is loaded using a relative path PHP first has to lookup where that file exists on the filesystem. Once cached futher includes will be far cheaper, however with small cache size by default entries will quickly churn when you consider that PHP frameworks such as Zend Framework contain well over a thousand files.

So what should it be set to? Well that largely depends on your personal situation, those with extreme symptoms of spaghetti-code-itous which vast numbers of library files should use higher values. Personally, on my modest Zend Framework installation I find a cache size of 128KB works well. As for the time to live (ttl) value this defaults to 2 minutes and should be tweaked on a per-case basis depending on how frequently the application is updated.


  1. http://uk.php.net/ini.core