In this section:
Overview
Jtest is launched by running jtestcli.exe
located in the Jtest installation directory. In the typical workflow, the executable is run from the dedicated plug-ins for the supported build systems, such as Maven,Ant and Gradle, but it can also be run manually the from the command line.
The jtestcli.exe
runs on jtest.data.json
data files that are automatically generated by the build system plug-ins. If you run jtestcli.exe
from the command line, use the -data
option to point to the .json
data file that will be used for analysis.
Using Build System Plug-ins
Typically, the jtestcli.ex
e is launched from a dedicated Jtest plug-in for Maven, Ant or Gradle. See Integrating with Build Systems for details, including plugin configuration and troubleshooting.
Add the $XTEST_ITX=714 environment variable to show arguments passed to jtestcli.exe executed by plug-ins.
Using jtestcli
from the Command Line
Run jtestcli.exe
from the command line to launch Jtest. You must at the minimum include a test configuration and specify the data file location to analyze code. See Configuring Test Configurations and Specifying Test Data Location for more information.
Your command line may resemble the following:
jtestcli.exe -settings settings.properties -config "builtin://Recommended Rules" -data demo.data.json -report report
Specifying Test Data Location
Use the -data
switch to point directly to a *.json
data file object generated by the build system plugin. The automatically-generated *.json
data file provides the same information as the workspace in a format specific to Jtest:
-data file
Build system plug-ins automatically add the data argument and include the value they generate, so there is no need to add it to the plug-in configuration.
Settings Property Pattern
The path to the data file can be configured with the jtest.data
option in the .properties file:
jtest.data=[path to file]
Data File Format
The data file (jtest.data.json
) is a stream of json objects automatically generated and formatted by Jtest build system plug-ins. It provides the same information about tested projects as the workspace. Each object in the file describes one project. Jtest currently supports the classpath_project common object type. See Configuring the Test Scope for an example.
Example Data File Object
{ "type": "classpath_project", "name": "project_name", "location" "/absolute/path/to/project", "compilations": [ { "sourcepath": [ "/absolute/path/to/srcdir1" ], "classpath": [ "/absolute/path/to/classdir1", "/absolute/path/to/buildfile.jar" ], "bootpath": [ "absolute/path/to/java/ajavalib.jar" ], "encoding": "project_encoding_name", "sourcelevel" "project_source_level" },{ ... } ] } { ... }
Displaying Detailed Progress Information
Use the -showdetails
switch to display detailed progress information:
-showdetails
Alternatively, you can configure showing detailed information by setting the console.verbosity
option to high
:
console.verbosity.level=high
Ant and Maven Pattern
If you use Ant or Maven, use the following pattern:
<showdetails>true</showdetails>
Specifying Jtest Data Location
Running analysis requires write permissions to the .jtest directory where Jtest stores run-specific data during analysis. By default, the directory is stored in the current working directory or in a build system's output directory, such as the target directory in Maven. You can specify the path to a custom location of the .jtest directory with the -workspace
command line option, for example:
-workspace /home/qa/jtestdata_project1