phpUnit testsuite

So far I've created two tests, AlphaTest and BravoTest. They're easy enough to manage because there are only two files that I would need to run.

phpUnit AlphaTest
phpUnit BravoTest

An issue starts to arise when you need to start managing more tests. You could run all the tests in a given directory

phpUnit .

However this can be certain overkill in a large system where changes are only made to a part of it.

Creating a testsuite

A testsuite allows you to group test files together to form a testsuite. I believe it is also possible to group testsuites together to form a composite testsuite. To start with you need to create a phpUnit.xml file, similar to what I have below.


    <testsuite name="Alpha">
      <!-- I could use the directory tag to include all *Test.php files, but I have no control over the order -->
      <!-- using the approach below, I can be more specific with the files I want to include... -->
    <testsuite name="all"> 

And to run a particular testsuite, you would do the following.

phpUnit --testsuite all


Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.