Integration of CoverageBrowser with an IDE

With some IDEs, it is possible to view coverage results directly in the editor window while writing code. For this, the IDE must support the Language Server Protocol or use a specific plugin.

The IDE then automatically starts a CoverageBrowser instance, which then sends the coverage measurements to the IDE. Lines in the IDE are highlighted dependent on their coverage level, and tooltips explain the coverage measurements. When the user moves the cursor to a code line in the IDE editor, the same line is shown and highlighted in the CoverageBrowser.

The CoverageBrowser instance persists as long as the IDE runs. When the IDE is closed, the CoverageBrowser finishes too.

Setup

To use the IDE integration, first the IDE must be configured to use the CoverageBrowser. This is described in the following chapter.

The next step is to start the IDE, let it start CoverageBrowser and select with it a .csmes file. If this file contains coverage measurements, the IDE shows them when it displays the instrumented files.

CoverageBrowser settings

Most of the time, loading the right .csmes file is enough to get the IDE integration working. But if needed, a bit more configuration can be done with the help of a menu IDE that only appears in the context of IDE integration.

It has the following entries:

  • Tool Tips to disable and enable the tool tips
  • Diagnostics to disable and enable line highlighting
  • For some configurations, Settings to open a configuration dialog

The Settings menu

This menu can have two different shapes, depending on the IDE that is integrated.

  • Severity.

    If CoverageBrowser acts as an ordinary license server, the correspondence between coverage levels and diagnostics can be changed. The following levels are displayed:

    • Executed
    • Unexecuted
    • Partially executed
    • Execution Count too low
    • Manually Validated

    For each of them, one can set an LSP diagnostic level. CoverageBrowser sends it to the IDE for each line with the given coverage level. It depends on the IDE how the diagnostic information is displayed, how code lines are highlighted. One needs to play around to get the right colors.

  • Information Displayed. This is currently used for IDE integration when using a customized plugin.

    In this form, the dialog contains a list of checkboxes to select the lines to highlight in the IDE.

Coco v7.2.0 ©2024 The Qt Company Ltd.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.