The jtest
task should be applied and executed only for the root project. You do not need to build a project before running analysis, but we recommend compiling multi-module projects beforehand by adding the build
or assemble
task to your command line, for example. Doing so enables Jtest to use artifacts from the local repository, reducing the amount of time necessary to test and analyze code.
Before you run analysis or collect coverage information with Gradle, ensure that the Jtest license is properly configured (see Setting the License). |
To perform static analysis on your code:
Execute the jtest task. Your command line may resemble the following:
gradle jtest -I PATH/TO/JTEST/integration/gradle/init.gradle |
The Jtest Plugin for Gradle will collect the necessary build data in the .json file, and analyze your code depending on the test configuration you provided.
You can include unit test results in the Jtest report by running your tests with the jtest task, and the dedicated Unit Tests
built-in test configuration:
Execute Gradle tasks in the following order:
- the test
(or build
) task to ensure that unit tests are executed
- the jtest task
Your command line may resemble the following:
gradle clean test jtest -Djtest.config="builtin://Unit Tests" |
You can collect coverage information during execution of unit tests by your tests with the jtest and jtest-agent tasks, and the dedicated Unit Tests
built-in test configuration:
Execute Gradle tasks in the following order:
- the jtest-agent task
- the test
(or build
) task to ensure that unit tests are executed
- the jtest task
Your command line may resemble the following:
gradle clean jtest-agent test jtest -Djtest.config="builtin://Unit Tests" |
We recommend using the jtest-agent task for collecting coverage. Offline instrumentation with the jtest-instument task is deprecated.
Jtest's coverage agent allows you to collect coverage data during manual or automated tests performed on a running application. See Application Coverage for information about collecting application coverage with Jtest.