The Code Train

Where Neil Crosby talks about coding on the train…

RSS Entries

Automated Frontend Testing – The Talk

Posted on April 14th, 2009 by Neil Crosby. Filed under Blog Posts.

A week ago, I finally gave my talk about Automated Frontend Testing for YDN Tuesdays, something which I’d been working towards for what seemed like forever. The video is now online, and I’ve also put the slidedeck up onto slideshare, with the accompanying audio synced up with the slides. I’m hoping to get a transcription of the talk sorted out over the next couple of days as well.

If you have any questions about anything that came up in the talk, please ask. I’ll do my very best to answer any questions.

Tags: , , , ,

If you enjoyed this post, subscribe to The Code Train and read more when I write more.

2 Responses to “Automated Frontend Testing – The Talk”

  1. Hi Neil,

    The Suite looks awesome.

    As my knowledge of PHP goes no further than messing with the WordPress loop, it took me a little while to get the suite up and running on my machine as I wasn’t sure what did what.

    I might be running it totally the wrong way, but here’s what I did, in my Idiot’s Guide to the Automated Frontend Testing Suite:

    1) Install PHP if you don’t already have it.

    I got the latest version from:

    During the install, I chose ‘Do not setup a web server’. I then recommend installing the entire PHP feature, as some of the extensions and extras are required to get PEAR/PHPUnit going.

    2) PEAR should have been installed with the package above. If not, you will nead to get it from

    3) To install PHPUnit, from the command line type

    pear channel-discover

    and then

    pear install phpunit/PHPUnit

    4) Download the test suite from and extract

    5) On lines 4 and 5 of suite/TheCodeTrainEasyFrontendTestSuite.php are two ‘require_once’ statements. I had to change these to point to the same files within my PHPUnit install location, so they now look like

    require_once('C:/Program Files/PHP/PEAR/PHPUnit/Framework/TestCase.php');
    require_once('C:/Program Files/PHP/PEAR/PHPUnit/TextUI/TestRunner.php');

    However, when I included the TestRunner.php file I got this error:

    'Fatal error: Cannot redclare class PHPUnitTextUITestRunner in 
    C:\Program Files\PHP\PEAR\PHPUnit\TextTI\TestRunner.php on line 783'

    I removed the second require_once from above and everything seems to still work ok.

    6) From lines 149 – 197 is a bunch of commented out code. By uncommenting this I was able to run my tests here.

    So, for example, I just want to play with the HTML Validator for now, so I replaced the commented block with:

            'html' => array(
                'validator' => '', // don't use this use a local one!
                'tests' => array(

    7) I wasted far too much time being an eejit and trying to run the validator at ‘http://mylocalvalidator’ rather than ‘http://mylocalvalidator/check’

    8) To run the suite, return to the command line and depending on where you’ve extracted the suite, type something like:

    phpunit C:\Development\frontentTestSuite\suite\TheCodeTrainEasyFrontendTestSuite.php

    I now get a lovely slew of validation errors in my command line window. I’ve not got as far as doing anything useful with them yet. I’m hoping that I can easily integrate this into a build process using the PHPUnit plugin for Maven – I’ll let you know how I get on!

  2. Thanks for the comment (and sorry it took so long to reply).

    Just so you know, I’ve rolled up what you said here and started to turn it into a bit of a quickstart Setup guide at – hopefully that’ll make it a bit easier for new people to start using the project in the future.

Comments RSS

Leave a Reply

TheCodeTrain Theme by Neil Crosby, Powered by WordPress