Code coverage
Code coverage in IntelliJ IDEA lets you analyze which lines of code were executed during a particular run. It helps determine the share of code covered by tests and identify areas that lack sufficient test coverage.
Enable the Code Coverage for Java plugin
This functionality relies on the Code Coverage for Java plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features are not available, make sure that you did not disable the plugin.
Press Ctrl+Alt+S to open settings and then select .
Open the Installed tab, find the Code Coverage for Java plugin, and select the checkbox next to the plugin name.
Run with coverage
The entry points for running coverage analysis are the same as you would normally use to run an application:
For main method definitions, click
Run in the editor gutter, then select Run with Coverage

For run configurations, click
More Actions in the Run widget, then select Run with Coverage

For Gradle tasks, go to Gradle tool window, right-click the task, and select Run with Coverage

Coverage analysis executes the corresponding run configuration with the coverage agent attached. This agent instruments the bytecode to keep track of the execution line-by-line. After the execution completes, the results of the analysis appear in the IDE.
Coverage suites
A coverage suite is a collection of code coverage data from a specific run. Each coverage suite stores data from either a single run configuration (if it was run with coverage) or from an imported coverage data file.
IntelliJ IDEA stores coverage suites in the coverage folder of the IDE system directory:
%LOCALAPPDATA%\JetBrains\IntelliJIdea2026.2\coverage
~/Library/Caches/JetBrains/IntelliJIdea2026.2/coverage
~/.cache/JetBrains/IntelliJIdea2026.2/coverage
IntelliJ IDEA can display results from one or more coverage suites at the same time, and you can select which suites to show. If multiple suites are selected, the IDE displays their merged results: this means that a line is considered covered if it was executed in at least one of the suites.
Select which coverage suites to display
In the main menu, go to (Ctrl+Alt+F6).
In the Choose Coverage Suite to Display dialog that opens, select the suites you want to display results from.
If you want to hide all code coverage results, click No Coverage instead. This deselects all coverage suites and closes the dialog.

Click Show Selected.
IntelliJ IDEA loads the code coverage results and opens the Coverage tool window.
Add and remove coverage suites
If you want to review code coverage results from a file that was generated outside IntelliJ IDEA (for example, by a build server or another developer), you can add the file as a separate coverage suite. This applies to files generated by JaCoCo (.exec or .xml) and the IntelliJ IDEA runner (.ic).
You can also remove suites from the IDE or completely delete them from disk.
In the main menu, go to (Ctrl+Alt+F6).
In the Choose Coverage Suite to Display dialog that opens, choose an action from the toolbar:
To import an external coverage file, click
Add and browse for the file.
To remove a coverage suite from the IDE but keep it on disk, select the suite and click
Remove.
To delete a coverage suite from both the IDE and the disk, select the suite and click
Delete.
Read coverage data
IntelliJ IDEA shows coverage results in:
Coverage tool window
Project tool window
Editor
Code coverage results are displayed in the Coverage tool window, in the Project tool window, and in the editor after you launch at least one run configuration with coverage.
Project tool window
The Project tool window displays:
the percentage of the covered classes and lines for directories
the percentage of the covered methods and lines for classes

Coverage tool window
The report breaks down the project by coverage percentage of classes, methods, lines, and branches.
Branch coverage shows the percentage of the executed branches in statements like if-else or switch. It is available for the JaCoCo runner and for the IntelliJ IDEA runner with the Branch Coverage option enabled.

The Coverage tool window has the following options:
Item | Description |
|---|---|
Select whether to show packages hierarchically or flatten the structure to show all of them on the same level. | |
If this option is on, IntelliJ IDEA automatically opens the selected item in the editor. Otherwise, you need to double-click items to open them. | |
If this option is on, IntelliJ IDEA automatically locates in the tool window the files that you open in the editor. | |
Generate a code coverage report and save it to the specified directory. For more information, refer to Generate coverage report. | |
Import a coverage suite from disk. | |
Filter coverage results. You can configure the following filters:
|
Editor
The editor displays the coverage status of individual code lines. The status is indicated by color-coded markers in the gutter:
Green (
): the code line was executed.Yellow (
): the code line was executed partially. This happens when the code line contains conditional logic (such as an if/elsestatement, a loop, or aswitchstatement), but only some of its branches were run.Red (
): the code line was not executed.
To open a popup with coverage statistics for a specific line, click its coverage marker in the gutter. Depending on which coverage runner you used, the popup displays different information:

For the IntelliJ IDEA runner, the popup can display the following information:
Hits: how many times the code line was executed.
If the line contains conditional logic (such as an
if/elsestatement, a ternary operator, or a loop):true hits: how many times the condition was true.
false hits: how many times the condition was false.
If the line contains a
switchstatement:case <value>: how many times a particular case was executed.

For the JaCoCo runner, the popup can display the following information:
Fully Covered: the code line was executed. If it contains conditional logic, all possible branches were run.
Partially Covered: the code line was executed, but only some branches of its conditional logic were run.
Uncovered: the code line was not executed at all.
Covered <number>/<number> branches: how many branches of the conditional logic were run vs. the total number of branches.
Additionally, the popup includes the following icons:
Previous <Coverage Status>
Navigate to the previous coverage marker and open its statistics.
Next <Coverage Status>
Navigate to the next coverage marker and open its statistics.
Show Tests Covering Line
Show tests that cover the code line in a separate popup.
Show Bytecode
Show the bytecode of the current class in a separate tool window.
Edit Coverage Colors
Open to customize the colors of coverage markers.

Hide coverage
Stop displaying coverage results in IntelliJ IDEA.
Hide coverage data
Do one of the following:
Close the tab with coverage statistics in the Coverage tool window ().
Click coverage highlighting in the gutter and select Hide coverage.
Generate coverage report
Go to , or click
in the Coverage tool window.
In the Generate Coverage Report dialog, specify the directory to store the generated report and optionally select the Open generated HTML in browser checkbox.
Configure code coverage
In IntelliJ IDEA, there are coverage settings that apply to individual run configurations, and those applicable per-project.
Run configuration settings
For each run configuration, you can specify the scope of the coverage analysis.
Configure classes and packages
Go to and click the run configuration on the left panel.
Click Modify options, then select the following options under Code Coverage:
Specify classes and packages: select this option to configure classes and packages for which you want to see the coverage information.
Exclude classes and packages: select this option to configure classes and packages that you want to exclude from coverage.
Project settings
For projects, you can configure the following options:
Show options before applying coverage to the editor | Ask whether to make the recently collected coverage suite active every time you run coverage analysis. In this case a dialog will appear, where you can choose to only display the new results, to add them to the existing results, or save them to storage without viewing. |
Do not apply collected coverage | Only save the recently collected coverage suite to storage after you have run coverage analysis. In this case, new coverage data will not be shown unless you explicitly select the corresponding suite in . |
Replace active suites with the new one | Hide the currently shown coverage suites and use the newly collected one after you have run coverage analysis. In this case, only the results from the most recent coverage run will be shown. |
Add to the active suites | Add the newly collected coverage suite to the list of active suites after you have run coverage analysis. This keeps the existing coverage results and adds the new results on top of it. |
Activate Coverage View | Open the Coverage tool window every time you run coverage analysis. |
Choose coverage runner | Select the coverage runner: IntelliJ IDEA or JaCoCo |
Branch coverage always on for JaCoCo | Collect granular coverage data for |
Track per test coverage only for IntelliJ IDEA runner | Lets you trace back to specific tests, during which a line was executed. For details, refer to Per-test coverage. |
Collect coverage in test folders only for IntelliJ IDEA runner | Collect code coverage statistics for tests. By default, coverage data only shows which lines were covered in source roots. Use this option to enable coverage collection in test roots as well. |
Ignore implicitly declared default constructors only for IntelliJ IDEA runner | Exclude the implicit default constructors from coverage statistics. No-arg constructors that are declared explicitly will remain included. |
Exclude annotations only for IntelliJ IDEA runner | Exclude elements marked with the specified annotations from coverage results, for example, Lombok's |
Change colors of the coverage highlighting
Press Ctrl+Alt+S to open settings and then select .
In the list of components, expand the Line Coverage node and select a type of coverage: for example, Full, Partial or Uncovered.
Click the Foreground field to open the Select Color dialog.
Select a color, apply the changes, and close the dialog.

Per-test coverage
When branch coverage is enabled, IntelliJ IDEA lets you track which lines of code are covered by each test and vice versa.
Enable per-test coverage
In , enable Branch coverage and Track per test coverage.
Track tests per line
To navigate to tests covering a specific line:
Click the coverage highlighting in the editor gutter, then select
Show Tests Covering Line.

Track lines per test
To only highlight the lines covered within a specific test:
In the Cover tool window, select a test and click Show Coverage per Test on the toolbar.
