Distributed Testing with PHPUnit 3.1

Sebastian Bergmann » 22 February 2007 » in New Features » 2 Comments

One of the new features in the upcoming PHPUnit 3.1 release is the support for distributed testing through the ability to log test result and code coverage data to a database. This way, the same test suite can be run on different platforms with the results being aggregated in the database. For this to work, however, we need a key in the database that identifies test runs from different machines as being related. A Subversion revision number is a perfect candidate for this.

Have a look at the shell script below. It accepts three parameters: the local checkout directory of the project's repository, the number of the revision for which to run the tests, and additional information which can be used to describe the environment in which the test suite is run.
#! /bin/sh
CHECKOUT="$1"
REVISION="$2"
INFO="$3"

cd "${CHECKOUT}"
svn up -r "${REVISION}"
cd "${CHECKOUT}/Tests"
phpunit --log-pdo-dsn mysql://user:pass@host/database \
--log-pdo-rev "${REVISION}" \
--log-pdo-info "${INFO}" \
AllTests.php
Invoking the shell script above will update the local checkout of the project's repository to the requested revision, run the test suite, and write test result and code coverage data to a database.

This logging of test result and code coverage data to a database is not only of interest when you need distributed testing. It is also the foundation of a, yet to be developed, browser-based application that provides more flexible and versatile reports whereas currently only static HTML files are generated.

The database schema can be found here. Feedback related to this new feature is, as always, appreciated.
Defined tags for this entry: , , ,

Trackback specific URI for this entry

2 Comments to "Distributed Testing with PHPUnit 3.1"

Display comments as (Linear | Threaded)
  1. JMF
    22/02/2007 at 13:09 Permalink
    Will it be possible with to this feature to run tests using Selenium on various OS and aggregate them in one report ?

    If so, it will be a great feature !

    Reply

  2. Sebastian Bergmann
    22/02/2007 at 13:24 Permalink
    Yes, this is possible.

    Reply

1 Trackback to "Distributed Testing with PHPUnit 3.1"

  1. Sebastian Bergmann 25/02/2007 at 10:55
    I started to collect ideas for features that I would like to see in PHPUnit but currently lack the time to implement myself. Mutation Testing Mutation Testing, or Automated Error Seeding, is an approach where the testing tool makes some change to the

Add Comment


To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Submitted comments will be subject to moderation before being displayed.