Writing an extension for SimpleTest

SimpleTest is hard-coded to be flexible and extensible. It means you can add your own assertions. You can also add your own reporter or any other tool worth your fancy. In fact there's a special directory inside SimpleTest SVN trunk devoted to such kind of experimentations.

Existing extensions

There's a growing list of available extensions:

colortext_reporter
provides an ANSI-colored {@link TextReporter} for viewing test results.
dom_tester
create a CSS Selector expectation.
pear_test_case
provides an adapter for PEAR PHPUnit test case to allow legacy PEAR test cases to be used with SimpleTest.
phpunit_test_case
provides an adapter for sourceforge PHPUnit test case to allow legacy test cases to be used with SimpleTest.
recorder
returns an array with timestamp, status, test name and message for each pass and failure.
selenese_tester
integrates selenese html test suite support (can be generated by selenium-IDE).
selenium
provides a bridge to a Selenium server.
testdox
...
treemap_reporter
constructs and renders a treemap visualization of a test run.
webunit_reporter
...

Committing a new extension

If you want to have your own extension accepted inside the SVN trunk, juste make sure you follow these simple rules:

  1. Main code goes into a file located at
    /extensions/my_new_extension.php
  2. If you need extra stuff (classes, sub-routines, js or css files), make sure everything is located your own
    /extensions/my_new_extension/*
  3. And since your package is unit-tested, your tests go into
    /extensions/my_new_extension/test/*
    or
    /extensions/my_new_extension/*
  4. Bonus : you can get your own test suite caught directly from SimpleTest. There's dedicated test scanning recursively the extensions' directories and running the test file matching /test.php$/. An easy way for us to check if everyone's extension carries on working with the current code base...
Also for general coding practices, you can have a look at the
coding standards and formatting.