When I worked at The Guardian, before committing code to Subversion, unit tests were run against the Java codebase. This is pretty standard. Sometimes, things slipped through and were caught at the Continuous Integration stage where an automated build would perform deeper tests and verify the code integrations of each developer hadn’t broken anything. This approach works extremely well.
Neil’s come up with a framework, called Frontend Test Suite, that automatically runs frontend code through the above tools. The suite is built in PHP and it is recommended that you install local copies of the HTML Validator, CSS Validator and JSLint so your IP doesn’t get banned.
I followed Neil’s installation steps in the file SETUP, which are briefly listed here:
- Installed PHP (didn’t really because it’s already installed with Mac OS X 10.5.7
- Installed PEAR
- Installed PHPUnit
- Downloaded Frontend Test Suite
- Installed HTML Validator locally
- Installed CSS Validator locally (thanks Jen)
- Installed Rhino
- Downloaded JSLint.js
I use Aptana regularly so, alongside the project I’m currently working on, I created a new project, dumped the Frontend Test Suite files into it and made the necessary edits to the example file. I execute the tests via the command line but at some point I will set up Aptana so I can execute it from there.
Next I need to workout how to get subversion to run these tests pre-commit.