# Code coverage

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

> **TL;DR**
> Add the `simplecov` gem to your `Gemfile` and [install it to your project interpreter](using-the-bundler.html#install_gems_local).

With RubyMine, you can measure how much of your code is covered with tests using the [SimpleCov](https://github.com/colszowka/simplecov) analysis tool. You can run tests with coverage for any supported [testing framework](testing-frameworks.html), analyze the percentage of covered files and lines in a separate tool window and editor, generate HTML reports, and so on.

> **Note:**
> RubyMine supports running tests with coverage for projects that use SSH, Vagrant, or local Ruby interpreters.

## Configure coverage run options

RubyMine allows you to run tests with coverage using specific run options. For example, you can exclude particular folders from coverage measurement. To provide specific coverage options, you need to have a run configuration for tests. A run configuration can be created in two ways:

* [Automatically](performing-tests.html) after performing tests

* [Manually](creating-run-debug-configuration-for-tests.html)

After creating a run configuration for tests, you can configure coverage options in the following way:

Procedure:

1. Press `Ctrl+Shift+A` (Windows), `⌘ ⇧ A` (macOS), `⌘ ⇧ A` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ P` (macOS System Shortcuts), `Ctrl+Shift+A` (XWin), `Ctrl+Shift+A` (GNOME), `Ctrl+Shift+A` (KDE), `Escape, X` (Emacs), `Ctrl+Shift+P` (Sublime Text), `⌘ ⇧ P` (Sublime Text (macOS)), `Ctrl+Shift+A` (Visual Studio), `⌘ ⇧ A` (Visual Studio (macOS)), `Meta+Shift+A` (TextMate), `Ctrl+I` (NetBeans), `Ctrl+Shift+A` (Eclipse), `⌘ 3` (Eclipse (macOS)) and start typing edit configurations. Select Edit Configurations and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Find Action](https://resources.jetbrains.com/help/img/idea/2026.3/ij_ruby_find_action_edit_config.png)

2. In the opened Run/Debug Configurations dialog, select the required configuration (for example, Rake, Test::Unit/Shoulda/Minitest, or RSpec), go to the Code Coverage tab and specify the desired settings.

![Run/Debug Configurations](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_run_configuration_dialog.png)

### Coverage settings for run configurations

| Option | Description |
| --- | --- |
|  ![the Add button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg)  |    Define the scope of code coverage analysis. In the Add Pattern dialog that opens, type the comma-delimited list of Ruby regular expressions. Select one of the pattern types defining whether the matching files should be included in or excluded from code coverage analysis.                                       Examples: `/config/`, `/bin/,/config/`    |
|  ![the Add button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.remove.svg)  | Click this button to delete the selected pattern from the list.  |
|  ![the Edit button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.edit.svg)  | Click this button to change the selected code coverage pattern. |
| Enable coverage in test folders |  Enable this option to include test folders (for example, `test` or `spec`) in code coverage analysis.  |
| Enable branch coverage (SimpleCov >= 0.18) |  Use this option to enable branch coverage. With this option enabled, you can see partially covered conditions in the editor when [viewing results](#view_results).  |
| Enable coverage for forked processes (SimpleCov >= 0.19) |  Enable this option to measure coverage for forked processes.  |

## Configure coverage measurement

Procedure: Configure code coverage behavior

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Build, Execution, Deployment | Coverage`.

2. Define how the collected coverage data will be processed:

* Show options before applying coverage to the editor: show the Code Coverage dialog every time you run a new run configuration with code coverage.

* Do not apply collected coverage: discard the new code coverage results.

* Replace active suites with the new one: discard the active suites and use the new one every time you launch a new run configuration with code coverage.

* Add to the active suites: add new code coverage suites to the active suites every time you launch a new run configuration with code coverage.

3. Select the Activate Coverage View checkbox to open the [Coverage](null) tool window automatically.

Procedure: Change colors of the coverage highlighting

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Editor | Color Scheme  | General`.

2. Alternatively, click ![the Edit Coverage Colors button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg) in the popup that opens on clicking the coverage indication line in the gutter.

3. In the list of components, expand the Line Coverage node and select a type of coverage: for example, Full, Partial or Uncovered.

4. Click the Foreground field to open the Select Color dialog.

5. Select a color, apply the changes, and close the dialog.

![Configure code coverage colors](https://resources.jetbrains.com/help/img/idea/2026.3/coverageColors.png)

## Run tests with coverage

RubyMine allows you to run tests with coverage in the following ways:

Procedure: Run tests with coverage using a predefined configuration

To run the tests with coverage using the already created [run configuration](#coverage_options), do one of the following:

* Press `Alt+Shift+F10` (Windows), `⌃ ⌥ R` (macOS), `⌥ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ R` (macOS System Shortcuts), `Alt+Shift+F10` (XWin), `Alt+Shift+F10` (GNOME), `Alt+Shift+F10` (KDE), `Alt+Shift+F10` (Emacs), `Alt+Shift+F10` (Sublime Text), `⌃ ⌥ R` (Sublime Text (macOS)), `Ctrl+Alt+Shift+R` (Visual Studio), `⌘ ⌥ ⇧ R` (Visual Studio (macOS)), `Meta+R` (TextMate), `Alt+Shift+F10` (NetBeans), `Alt+Shift+F10` (Eclipse), `⌃ ⌥ R` (Eclipse (macOS)), select the required configuration, press the right arrow key, select Cover, and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

* To run tests with coverage from the main toolbar:

1.  Select the required run configuration from the list on the main toolbar.

2.  Click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.more.svg) More Actions in the [Run widget](new-ui.html#window_header), then select Run with Coverage.

![Run with Coverage](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_run_toolbar.png)

Procedure: Run tests with coverage from the Project view

To run a test or multiple tests with coverage from the Project view, do the following:

1. Right-click a specific test file or a directory containing the required tests (for example, `test`, `spec`, or `features`).

2. From the context menu, select the corresponding run command, for example, `Run 'All tests in: <directory name>' with Coverage`.

Procedure: Run tests with coverage from the editor

To run tests from the editor, perform the following steps:

1. Click the Run button on the left gutter next to the required test or test class.

![Run a specific test](https://resources.jetbrains.com/help/img/idea/2026.3/rm_run_specific_test_with_coverage.png)

2. From the context menu, select the required run command, for example, `Run '<test name>' with Coverage`.

## View coverage results

After [running tests](#run_with_coverage) with coverage, RubyMine displays results in the following ways:

Procedure:

* In the Project view.

![Coverage results in the Project view](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_results_project_view.png)

Here you can navigate through a project and examine the percentage of covered files and lines.

* In the Cover tool window.

![Coverage results in a dedicated tool window](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_results_tool_window.png)

You can enable the ![Navigate with Single Click](https://resources.jetbrains.com/help/img/idea/2026.3/app.general.autoscrollToSource.svg) option to open a selected file in the editor automatically. The ![Generate Coverage Report](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.export.svg) button allows you to generate an [HTML report](#html_report) based on coverage results.

* In the editor.

Use the color indicators in the gutter to detect the uncovered lines of code.

![Coverage results in the editor](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_results_editor.png)

To find out how many times a line has been hit, click the corresponding color indicator.

![Coverage settings in the editor](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_results_editor_hits.png)

In the opened popup, you can click ![Edit Coverage Colors button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg) to configure code coverage colors or hide coverage results by clicking the Hide coverage link. For more information about displaying hidden coverage results, refer to [Coverage suites](#manage_results).

> **Tip:**
> Learn how to create missing tests from the [Create tests](create-tests.html) topic.

## 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](#run_with_coverage)) or from an [imported coverage data file](#add-remove-coverage-suite).

RubyMine stores coverage suites in the `coverage` folder of the [IDE system directory](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#system-directory):

Windows:
`%LOCALAPPDATA%\JetBrains\RubyMine2026.3\coverage`

macOS:
`~/Library/Caches/JetBrains/RubyMine2026.3/coverage`

Linux:
`~/.cache/JetBrains/RubyMine2026.3/coverage`

RubyMine 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.

Procedure: Select which coverage suites to display

The list of coverage suites becomes available after at least one [run with coverage](null).

1. In the main menu, go to `Run | Manage Coverage Reports…` (`Ctrl+Alt+F6` (Windows), `⌘ ⌥ F6` (macOS), `⌘ ⌥ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ F6` (macOS System Shortcuts), `Ctrl+Alt+6` (XWin), `Ctrl+Alt+6` (GNOME), `Ctrl+Alt+6` (KDE), `Ctrl+Alt+F6` (Emacs), `Ctrl+Alt+F6` (Sublime Text), `⌘ ⌥ F6` (Sublime Text (macOS)), `Ctrl+Alt+F6` (Visual Studio), `⌘ ⌥ F6` (Visual Studio (macOS)), `Meta+Alt+F6` (TextMate), `Ctrl+Alt+F6` (NetBeans), `Ctrl+Alt+F6` (Eclipse), `⌘ ⌥ F6` (Eclipse (macOS))).

2. 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.

![Choose Coverage Suite to Display dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rm_code_coverage_suite_dialog.png)

3. Click Show Selected.

RubyMine loads the code coverage results   for the selected suites.

Procedure: Add and remove coverage suites

If you want to review code coverage results from a file that was generated outside RubyMine (for example, by a build server or another developer), you can add the file as a separate coverage suite.

You can also remove suites from the IDE or completely delete them from disk.

1. In the main menu, go to `Run | Manage Coverage Reports…` (`Ctrl+Alt+F6` (Windows), `⌘ ⌥ F6` (macOS), `⌘ ⌥ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ F6` (macOS System Shortcuts), `Ctrl+Alt+6` (XWin), `Ctrl+Alt+6` (GNOME), `Ctrl+Alt+6` (KDE), `Ctrl+Alt+F6` (Emacs), `Ctrl+Alt+F6` (Sublime Text), `⌘ ⌥ F6` (Sublime Text (macOS)), `Ctrl+Alt+F6` (Visual Studio), `⌘ ⌥ F6` (Visual Studio (macOS)), `Meta+Alt+F6` (TextMate), `Ctrl+Alt+F6` (NetBeans), `Ctrl+Alt+F6` (Eclipse), `⌘ ⌥ F6` (Eclipse (macOS))).

2. In the Choose Coverage Suite to Display dialog that opens, choose an action from the toolbar:

* To import an external coverage file, click ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg) Add and browse for the file. The files with coverage data generated by RubyMine are saved to the `coverage` folder in the IDE [system directory](directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#system-directory) by default.

* To remove a coverage suite from the IDE but keep it on disk, select the suite and click ![the Remove button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.remove.svg) Remove.

* To delete a coverage suite from both the IDE and the disk, select the suite and click ![the Delete button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.delete.svg) Delete.

## Generate HTML report

RubyMine allows you to generate an HTML report for the [collected coverage results](#view_results).

Procedure:

1. In the main menu, go to `Run | Generate Coverage Report`, or click ![the Generate Coverage Report button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.export.svg) in the [Coverage](#view_results) tool window.

2. In the Generate Coverage Report dialog, specify the directory where the generated report will be stored. Optionally, select Open generated HTML in browser. Click Save.

## See also

### Reference

### External Links

[https://github.com/colszowka/simplecov](https://github.com/colszowka/simplecov)

