PhpStorm 2024.3 Help

View code coverage results

Code coverage results are displayed in the Coverage tool window, in the Project tool window, and in the editor after you run at least one test configuration with coverage.

Code coverage results

Additionally, these results are saved to the coverage folder in the IDE system directory.

Coverage tool window

The Coverage tool window opens right after you run a test configuration with coverage. The report shows:

  • For a directory: the percentage of the covered files and lines.

  • For a file: the percentage of the covered lines.

The Coverage tool window has the following options:

Item

Description

the Navigate with Single Click button

If this option is on, PhpStorm automatically opens the selected item in the editor. Otherwise, you need to double-click items to open them.

the Always Select Opened Element button

If this option is on, PhpStorm automatically locates in the tool window the files that you open in the editor.

the Import External Coverage Report button

Import a coverage suite from disk.

Filters

Filter coverage results. You can choose to view only the classes with uncommitted changes to focus on recent updates or hide the classes that are fully covered with tests.

If you want to reopen the Coverage tool window, go to Run | Show Code Coverage Data in the main menu, or press Ctrl+Alt+F6.

Code coverage results in the Project tool window

The Project tool window shows:

  • For a directory: the percentage of the covered files and lines.

  • For a file: the percentage of the covered lines.

Code coverage results in the editor

In the editor, lines of code are coloured in the gutter according to their code coverage status:

  • Full code coverage Green – lines that have been executed

  • Full code coverage Red – lines that have not been executed

To find out how many times a specific code line has been run, or hide coverage results from the editor, click its gutter color indicator.

Coverage results shown in the editor
    Last modified: 08 October 2024