Hello,

My name is Shashikant and I am a Senior Developer in Test working for www.bbc.co.uk/programmes.

BBC /programmes aims to ensure that every programme the BBC broadcasts has a permanent, findable web presence. For more detail read David Marland's post "BBC Programme pages: content driven responsive redesign".

Recently, I was involved in the task of generating CI reports on Hudson. Hudson is our Continuous Integration Server. We needed to have visibility of unit tests, integration tests and JavaScript tests. This included generating code coverage reports and making them visible to the team. We generated most of the CI reports for PHP, JavaScript and Cucumber on Hudson. Let's see how we configured Hudson to generate various reports.

Continuous Integration for PHP

/programmes is a BBC PAL application. We use Zend MVC framework and we have many unit tests for Controllers, Modules, Views and routes written in PHPUnit. We used the following tools to setup Hudson for PHP.

PHP Toolkit

Dependency Management : Composer

Composer is a dependency management application for the PHP. Composer is used to install all the nessessary php related tools in order to generate CI reports.

Build Tools: Maven and Phing

We used combination of Maven and phing for the /programmes build. Phing runs all PHPunit Tests and Maven build and deploy assets to the server. Maven calls phing targets located in the separate build file.

Testing Frameworks: PHPUnit

PHPunit is a unit testing framework for the PHP. There is a phing-phpunit-task which runs all our unit tests and generates coverage and Junit reports.

CI Reports generated: Coverage, PHPMD, PHPCPD, JUNIT, PHPLOC, Check-style and PHP code browser.

There is a Jenkins- PHP-Template available online, taking some references from there we got a list of all the PHP reports.

Report Generation

We have PHP installed on the Hudson and it also has all the basic plug-ins to display those reports. Basically, you need to have checkstyle,cloverphp, htmlpublisher, jdepend, plot, pmd, violations and xunit plugins installed.

Using Composer

Composer is a good tool to manage dependencies and versions of the php tools. We also used php tools like phpunit, phpcs, phploc, pdepend, phpmd, phpcpd and phing. We used composer.json file which look very similar to one available on Github.

We can download and install all those dependencies locally just by running following command where composer.json is located

$ curl -sS https://getcomposer.org/installer | php

$ php composer.phar install

This approach won't be right for CI, where we created an executable task for composer to download and install php dependences using the code below. This is a task in the pom.xml file which downloads composer dependencies. There is another executable 'phing' which runs unit tests