The IntelliJ IDEA coverage engine in TeamCity is the same engine that is used within IntelliJ IDEA to measure code coverage. This coverage attaches to the JVM as a java agent and instruments classes on the fly when they are loaded by the JVM. In particular that means that classes are not changed on the disk and can be safely used for distribution packages.
The IntelliJ IDEA coverage engine currently supports Class, Method and Line coverage. There is no Branch/Block coverage yet.
To configure code coverage using IntelliJ IDEA engine, follow these steps:
- While creating/editing Build Configuration, go to the Build Step page.
- Select the Ant, IntelliJ IDEA Project, Gradle or Maven build runner.
- In the Code Coverage section, select IntelliJ IDEA as a coverage tool in the Choose coverage runner drop-down.
- Set up the coverage options - refer to the description of the available options below.
Classes to instrument
Specify Java packages for which code coverage will be gathered. Use new-line delimited patterns that start with a valid package name and contain
*. For example:
Classes to exclude from instrumentation
Use newline-separated patterns for fully qualified class names to be excluded from the coverage, for example:
*Test. Exclude patterns have priority over include patterns.