<?xml version="1.0"?>
<!-- $Id: download_website.xml 1684 2008-03-06 08:36:59Z pp11 $ -->
<page title="Writing an extension for SimpleTest" here="Writing an extension">
    <long_title>Writing an extension for SimpleTest</long_title>
    <content>
        <introduction>
            <p>
                SimpleTest is coded to be flexible and extensible.
                It means you can <a href="subclass_tutorial.php">add your own assertions</a>.
                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.
            </p>
        </introduction>
        <section name="existing-extensions" title="Existing extensions">
            <p>
                There's a growing list of available extensions:
            </p>
            <dl>
                <dt>colortext_reporter</dt>
                <dd>
                    provides an ANSI-colored {@link TextReporter} for viewing test results.
                </dd>
                <dt>dom_tester</dt>
                <dd>
                    create a CSS Selector expectation.
                </dd>
                <dt>pear_test_case</dt>
                <dd>
                    provides an adapter for PEAR PHPUnit test case to allow
                    legacy PEAR test cases to be used with SimpleTest.
                </dd>
                <dt>phpunit_test_case</dt>
                <dd>
                    provides an adapter for sourceforge PHPUnit test case to allow
                    legacy test cases to be used with SimpleTest.
                </dd>
                <dt>recorder</dt>
                <dd>
                    returns an array with timestamp, status, test name
                    and message for each pass and failure.
                </dd>
                <dt>selenese_tester</dt>
                <dd>
                    integrates selenese html test suite support
                    (can be generated by selenium-IDE).
                </dd>
                <dt>selenium</dt>
                <dd>
                    provides a bridge to a Selenium server.
                </dd>
                <dt>testdox</dt>
                <dd>
                    ...
                </dd>
                <dt>treemap_reporter</dt>
                <dd>
                    constructs and renders a treemap visualization of a test run.
                </dd>
                <dt>webunit_reporter</dt>
                <dd>
                    ...
                </dd>
            </dl>
        </section>
        <section name="committing-a-new-extension" title="Committing a new extension">
            <p>
                If you want to have your own extension accepted inside the SVN trunk,
                juste make sure you follow these simple rules: 
                <ol>
                    <li>
                        Main code goes into a file located at<br />
                        <code>/extensions/my_new_extension.php</code>
                    </li>
                    <li>
                        If you need extra stuff (classes, sub-routines, js or css files),
                        make sure everything is located your own<br />
                        <code>/extensions/my_new_extension/*</code>
                    </li>
                    <li>
                        And since your package is unit-tested,
                        your tests go into<br />
                        <code>/extensions/my_new_extension/test/*</code><br />
                        or<br />
                        <code>/extensions/my_new_extension/*</code>
                    </li>
                    <li>
                        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
                        <code>/test.php$/</code>.
                        An easy way for us to check if everyone's extension carries
                        on working with the current code base...
                    </li>
                </ol>
                Also for general coding practices, you can have a look at the
                <a href="coding_standards.php">coding standards and formatting</a>.
            </p>
        </section>
    </content>
    <internal>
        <link><a href="#existing-extensions">Existing extensions</a></link>
        <link><a href="#committing-a-new-extension">Committing a new extension</a></link>
    </internal>
    <external>
    </external>
    <meta>
        <keywords>
            software development,
            php programming,
            programming php,
            software development tools,
            php tutorial,
            free php scripts,
            architecture,
            php resources,
            mock objects,
            plugins,
            extensions,
            extension,
            selenium,
            selenese,
            testdox,
            treemap,
            reporter
        </keywords>
    </meta>
</page>
