Configuring Code Coverage Measurement
IntelliJ IDEA makes it possible to configure the various aspects of code coverage measurement. In this section:
- Configuring the way coverage suites are processed
- Configuring code coverage measurement options
- Changing colors of the coverage highlighting
To configure code coverage behavior
- Open the Settings/Preferences dialog box, and then click Coverage under Build, Execution, Deployment. The Coverage page opens.
- Define how the collected coverage data will be processed:
- To have the Code Coverage dialog box shown every time you launch a new run configuration with code coverage, choose Show options before applying coverage to the editor.
- To discard the new code coverage results, choose Do not apply collected coverage.
- To discard the active suites and use the new one every time you launch a new run configuration with code coverage, choose Replace active suites with the new one.
- To have the new code coverage suite appended to the active suites every time you launch a new run configuration with code coverage, choose Add to active suites.
- Define the behaviour of the Coverage tool window when an application or test is run with coverage:
To configure code coverage options
- Open the Edit Run/Debug Configuration dialog box, add the desired run/debug configuration, and click the Code Coverage tab.
- In the Code Coverage tab, define the following options:
- From the Choose coverage runner drop-down list, select the desired code coverage runner. The available options are:
- Choose the options for the selected runner:
- Specify the scope to measure code coverage for. Do one of the following:
- To have code coverage statistic collected for folders with tests as well, select the Enable Coverage in Test Folders check box.
To configure code coverage colors
- Open the Colors and Fonts page of the editor settings.
Alternatively, just click in the statistics pop-up.
- Expand Colors and Fonts node, and select General.
- In the list of textual components, select the required type of coverage, for example, Full, Partial or Uncovered, and then choose the desired colors:
Last modified: 18 July 2017