User Guide > Tasks > Using PHPUnit Testing > Running a PHPUnit Test Suite

Running a PHPUnit Test Suite

This procedure describes how to run a PHPUnit Test Suite and how to analyze the results.

Before running a PHPUnit Test Suite, one needs to be created by following the instructions under Creating a PHPUnit Test Suite.

 

 

Instructions on how to complete a procedure

To run a PHPUnit Test Suite:

  1. Open your PHPUnit Test Suite.

  2. Click the arrow next to the Run button on the toolbar and select Run As | PHP Unit Test  -or- from the Main Menu, go to Run and select Run As | PHP Unit Test -or- right-click the file in PHP Explorer view and select Run As | PHP Unit Test.
    All the PHPUnit Test Cases contained inside the PHPUnit Test Suite will be run.

PHPUnit View

  1. The PHPUnit view will be displayed, with a section showing all the tests run and the results, and two extra tabbed views showing code coverage and failure trace.
    The results of the individual PHPUnit Test Cases will be displayed in a tree diagram.

  2. Expand the nodes to see the results for each of the individual test cases.
    Tests that have passed successfully will be displayed with a green tick icon.
    Tests that have failed will be displayed with a blue X icon.
    Tests that have not been implemented (i.e. that tests have not been written for), will have passed  but will have a note indicating that they have not been implemented.

  3. Double-click on a failed result (if applicable) to be taken to the test function in the test file.
    To correct the failed result, either fix the test function or the original function on which it was run.

  4. The Code Coverage display indicates how much of the code in both the original file and the test file was run.
    Click on the code coverage statistics next to each file to open the Code Coverage view displaying the code with the lines of code that were run highlighted in blue.

  5. Once you have corrected errors, you can re-run the PHPUnit Test by clicking the Run Last Test button in the PHPUnit view until all tests pass successfully.

 

 

 

Related Links:

PHPUnit Testing

Working with PHPUnit Testing

Using PHPUnit Testing

Creating a PHPUnit Test Case

Creating a PHPUnit Test Suite

Running a PHPUnit Test Case

Reporting on PHPUnit Test Results

PHPUnit Preferences

 

 

©1999-2013 Zend Technologies LTD. All rights reserved.