PhpStorm 2023.3 Help

Managing code coverage suites

PhpStorm provides a tool to select coverage suites for showing or hiding, adding, and removing suites.

Select a coverage suite

The list of coverage suites becomes available after you run at least one test with coverage.

  1. In the main menu, go to Run | Show Coverage Data (Ctrl+Alt+F6).

  2. Click Show selected. The dialog closes. In the editor, PhpStorm opens test coverage results for the selected test suites.

  3. To hide the coverage results, select the checkboxes next to the necessary classes and click No Coverage.

Reading code coverage results

  • In the gutter, PhpStorm highlights how different parts of code are covered in your application. The following levels of coverage are indicated:

    • Full (Full code coverage): indicates that the line of code or code block was executed during testing and application execution. In tests, this means that every part of this specific code segment has been covered by one or more tests. In application code, it means that the line was executed by some other code in the application, not just tests.

    • Partial (

      Full code coverage

      ): indicates that only a portion of the code in the line or block was executed during testing or application execution. This typically occurs in complex statements with multiple conditions, where only some conditions were tested or executed.

    • Uncovered (Full code coverage): indicates that the line of code or code block has not been executed at all during testing or application execution. This suggests a potential risk, as untested or dead code might contain undetected bugs.

Upload or remove a coverage suite

Consider a situation when a file that contains code coverage information has been obtained from the build server. You can load this file from the disk and examine it in PhpStorm. Also, you can open the coverage data that has been generated by the IDE some time ago.

  1. In the main menu, go to Run | Show Coverage Data (Ctrl+Alt+F6).

  2. Click the Add button and select the necessary .xml file in the dialog that opens.

    The files with coverage data generated by PhpStorm are saved to the coverage folder in the IDE system directory by default.

  3. To remove a suite from the list and from the storage, select it in the list and click the Delete button.

Last modified: 20 February 2024