To create a test suite with Gradle:

  1. Ensure that the Jtest Plugin for Gradle is set up (see Configuring the Jtest Plugin for Gradle).
  2. Ensure that unit test creation is properly configured (see Unit Test Creation Configuration).
  3. Execute the jtest task, and provide the location to the script with the -I option to apply the plugin. Use the dedicated Create Unit Tests built-in test configuration (you can also create your own test configuration based on it).

Example 1:

gradle jtest 
 -Djtest.config="builtin://Create Unit Tests"
 -I PATH/TO/JTEST/integration/gradle/init.gradle

Example 2:

In this example, the .properties file and resources are also specified.

gradle jtest 
 -Djtest.config="builtin://Create Unit Tests"
 -Djtest.settings="jtestcli.properties"
 -Djtest.includes=**/Money,**/Simple
 -I PATH/TO/JTEST/integration/gradle/init.gradle

See the description of the include and includes parameters for details. 

Jtest does not support test configurations that combine static analysis or metrics analysis with unit test creation. Unit test creation must be performed as a separate Jtest run from static and metrics analysis.

You can view the test creation results in the console:

  • No labels