C.66 SimpleTestTask
Prev | Appendix C. Optional tasks | Next

## C.66 SimpleTestTask

This task runs testcases using the SimpleTest framework.

Table C.94: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`printsummary` | `Boolean` | Print one-line statistics for each testcase. | `false` | No
`haltonerror` | `Boolean` | Stop the build process if an error occurs during the test run. | `false` | No
`haltonfailure` | `Boolean` | Stop the build process if a test fails (errors are considered failures as well). | `false` | No
`failureproperty` | `String` | Name of property to set (to true) on failure. | n/a | No
`errorproperty` | `String` | Name of property to set (to true) on error. | n/a | No
`debug` | `Boolean` | Switch debugging on/off | `false` | No

### 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

  Name | Type | Description | Default | Required
  --- | --- | --- | --- | ---
  `type` | `String` | Use a predefined formatter (either `xml`, `plain`, or `summary`). | n/a | One of these is required.
  `classname` | `String` | Name of a custom formatter class. | n/a
  `usefile` | `Boolean` | Boolean that determines whether output should be sent to a file. | `true` | No
  `todir` | `String` | Directory to write the file to. | n/a | No
  `outfile` | `String` | Filename of the result. | Depends on formatter | No

- `fileset`

Prev | Up | Next
C.65 SshTask | Home | C.67 SvnCheckoutTask