C.66 SimpleTestTask

This task runs testcases using the SimpleTest framework.

Table C.94: Attributes

NameTypeDescriptionDefaultRequired
printsummaryBooleanPrint one-line statistics for each testcase.falseNo
haltonerrorBooleanStop the build process if an error occurs during the test run.falseNo
haltonfailureBooleanStop the build process if a test fails (errors are considered failures as well).falseNo
failurepropertyStringName of property to set (to true) on failure.n/aNo
errorpropertyStringName of property to set (to true) on error.n/aNo
debugBooleanSwitch debugging on/offfalseNo

C.66.1 Example

<simpletest>
  <formatter type="plain"/>
  <fileset dir="tests">
    <include name="**/*Test*.php"/>
    <exclude name="**/Abstract*.php"/>
  </fileset>
</simpletest>

Runs all matching testcases in the directory tests, writing plain text results to the console.

<simpletest haltonfailure="true" haltonerror="true">
  <formatter type="plain" usefile="false"/>
  <fileset dir="tests">
    <include name="**/*Test*.php"/>
  </fileset>
</simpletest>

Runs all matching testcases in the directory tests, writing plain text results to the console. The build process is aborted if a test fails.

C.66.2 Supported Nested Tags

  • formatter

    The results of the tests can be printed in different formats. Output will always be sent to a file, unless you set the usefile attribute to false. The name of the file is predetermined by the formatter and can be changed by the outfile attribute.

    There are three predefined formatters - two print the test results in XML format, the other one prints plain text. Custom formatters that implement phing.tasks.ext.PHPUnitResultFormatter can be specified.

    If you use the XML formatter, it may not include the same output that your tests have written as some characters are illegal in XML documents and will be dropped.

    Table C.95: Attributes

    NameTypeDescriptionDefaultRequired
    typeStringUse a predefined formatter (either xml, plain, or summary).n/aOne of these is required.
    classnameStringName of a custom formatter class.n/a
    usefileBooleanBoolean that determines whether output should be sent to a file.trueNo
    todirStringDirectory to write the file to.n/aNo
    outfileStringFilename of the result.Depends on formatterNo

  • fileset