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, it 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.
tip
Make sure your tests run in the fork=true mode. Otherwise, the coverage data may not be properly collected.
note
Note that IDEA coverage is not currently supported for Android projects built via Gradle. See the related feature request in our tracker.
To configure code coverage using IntelliJ IDEA engine, follow these steps:
While creating/editing Build Configuration, go to the Build Step page.
In the Code Coverage section, select IntelliJ IDEA as a coverage tool in the Choose coverage runner drop-down menu.
Set up the coverage options - refer to the description of the available options below.
Option
Description
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, org.apache.*.
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.
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions. Learn more.
With your consent, JetBrains may also use cookies and your IP address to collect individual statistics and provide you with personalized offers and ads subject to the Privacy Notice and the Terms of Use. JetBrains may use third-party services for this purpose. You can adjust or withdraw your consent at any time by visiting the Opt-Out page.