This page lists the command line options for jtestcli.

Configuring the Test Configuration

-config <config_url>

This option allows you to specify the test configuration that will be used for analysis. The option must be followed by the name of a built-in, user-defined, or DTP-hosted test configuration. Examples:

  • jtestcli -config "builtin://Critical Rules"
  • jtestcli -config "user://My_Config"
  • jtestcli -config "dtp://New_Rules"

-listconfigs

This option prints a list of available test configurations and can be used to obtain a valid test configuration name you can pass with the -config option.

You can specify a pattern to filter available configurations. Examples:

  • -listconfigs builtin (prints all built-in test configurations)
  • -listconfigs builtin*Top* (prints all built-in configurations whose names include "Top")

 See Configuring Test Configurations for details.

Configuring the Input Scope

 -data <path>

This option specifies the location of the custom json.data.file. See Creating a Custom .json Data File.


-resource <path relative to the project>

This option narrows down the primary testing scope defined in the JSON data file. You can use Ant-style wildcards to specify patterns. Examples:

  • -resource ProjectName/src (analyzes every file in the selected directory and its subdirectories)

  • -resource ProjectName/**/*.java (analyzes every Java file from selected project)

  • -resource **/src/main/java/my/company/*.java (analyzes every Java file from the specified subdirectory of every project in current build)

  • -resource c:/resource.lst (analyzes the projects listed in the resource.lst file; specify one project name per line)

You can use this option multiple times on the same command line  to specify multiple resources.

-include <absolute path> and -exclude <absolute path>

These options narrow down the primary testing scope defined in the JSON data file.  They allow you to specify files and packages to be included or excluded during testing. You can use Ant-style wildcards to specify the resource.

You can provide one of the following:

  • a fully-qualified name of a resource
  • an absolute path on disk with the "path:" prefix

Examples:

  • include com/** (tests all files in packages whose qualified names begin with "com)
  • include **/*Account (tests files whose qualified names end with "Account")
  • include path:**/Bank.java (tests only Bank.java files)
  • include path:C:/Project/src/** (tests all subdirectories and files in C:/Project/src/)
  • include path:C:/Project/src/examples/runtime/* (tests all files in C:/Project/src/examples/runtime, but not subdirectories)
  • include c:/include.lst (tests all files listed in the include.lst file ; each line is treated as a single pattern)
  • exclude **/internal/** (tests everything in the primary testing scope except files that have "internal" as part of the package name)
  • exclude path:**/tests/** (tests everything in the primary testing scope except the files in the "tests" folder)
Alternatively, you can specify a list of patterns in a  .lst file and pass the file with the -include or -exclude switch. Each line in the file will be treated as a single entry.

-data.update <pattern>

This option specifies project compilation data you want to add or overwrite in a JSON data file. It allows you to manually modify your JSON file by configuring the classpath, bootpath,sourcepath, binarypath, encoding, and sourcelevel with one of the following instructions:

  • prepend <path to file>- Adds one or more entries at the beginning of the list. You can specify a comma-separated list of paths to multiple files.
  • append <path to file> - Adds one or more entries  at the end of the list. You can specify a comma-separated list of paths to multiple files.
  • set <value> - Overwrites the current value.

Acceptable patterns :

  • compilations.classpath.append=<path>
  • compilations.classpath.prepend=<path>
  • compilations.bootpath.append=<path>
  • compilations.bootpath.prepend=<path>
  • compilations.sourcepath.append=<path>
  • compilations.sourcepath.prepend=<path>
  • compilations.binarypath.append=<path>
  • compilations.binarypath.prepend=<path>
  • compilations.encoding.set=<character encoding>
  • compilations.sourcelevel.set=<project source level>

Examples:

  • -data.update compilations.classpath.append="/tmp/last1.jar","/tmp/last2.jar"
  • -data.update compilations.encoding.set="UTF-8"
  • -data.update compilations.bootpath.prepend="/tmp/first.jar";compilations.sourcelevel.set="1.8"

See Compilation Data Model for details.

See Configuring the Test Scope for details about configuring the test scope.

Creating a Custom JSON

This set of options allows you to manually create a custom .json data file Jtest will use for analysis. You can use Ant-style wildcards to configure the options. If you want to configure more than one value, you can list the values in a  .lst file and pass the file with the command line option.

-project.location

(info) Required.

This option enables generation of the .json file by specifying the root of the project. Provide an absolute path to an existing directory.

By default, an example.data.json file is created in the root of the project configured with this option but you can customize the location and name of the .json file using -project.jsonpath.

All paths included in the Jtest report generated after analysis will be relative to the root of the project configured with this option.

-project.jsonpath

This option specifies a custom location and name of the .json file you want to create. Ensure you provide a path to an existing directory.

-project.name

(info) Required.

This option specifies the name of the project.

-project.encoding

(info) Required.

This option specifies encoding of the project.

-project.sourcepath

This option specifies the source of project. You can this option multiple times to specify multiple source folders.

-project.sourcelevel

This option specifies the Java compiler compliance level.

-project.classpath

This option specifies specifies the classpath.

-project.javahome

(info) Required.

This option specifies the path to the JDK installation directory.

-project.classpath.jars.dir

This option specifies the path to the directory with jars that you want to append to the project classpath.

(warning) You must view the JSON file when created to verify the order of the jars and ensure it meets your project requirements.

-project.junit.outcomes

This option specifies the path to the XML file with JUnit test results that will be used to generate a report. You can this option multiple times to specify multiple report files.

-project.compilation.classes

This option specifies the path to the compiled project classes that will be used to generate metadata information required to perform the "Calculate Application Coverage" configuration.

Example:

-project.location C:/ExampleProject
-project.jsonpath C:/project1/test/project1.json
-project.name ExampleProject
-project.encoding UTF-8
-project.sourcepath C:/ExampleProject/src
-project.sourcelevel C:/ExampleProject/src-test
-project.classpath C:/ExampleProject/lib/test.jar;C:/ExampleProject/lib/test2.jar
-project.javahome C:/Program Files/Java/jdk1.7

Reporting

-report <path>

This option specifies the path to the directory where the report will be created.

-publish

This option sends the results to DTP. See Sending Results and Publishing Source Code to DTP.

Customizing Configuration

-settings <path>

This option specifies the path to a custom .properties file that includes customized settings in the following format: key=value (for example, report.format=pdf). You can use this option multiple times to specify several .properties files. Entries with the same key will be overwritten. Example:

  • -settings Project1Config.properties

-property <key>=<value>

This option allows you to configure a single setting directly in the command line.  Use the following format: key=value.

You can use this option multiple times to configure several settings on the same command line. Earlier entries with the same key will be overwritten. Examples:

  • -property session.tag=sa_linux -property report.dtp.publish=true -property techsupport.create.on.exit=true

-showsettings

This option prints the current settings and customizations.

See Configuration Settings for the list of settings you can configure.

Collecting Coverage

- staticcoverage

This option specifies a path to the coverage.xml file that contains static coverage data.

- runtimecoverage

This option specifies the path to the runtime coverage data file downloaded via CAM. Alternatively, you can provide a path to a folder that contains multiple runtime coverage data files from more than one testing session.

See Application Coverage for details.

Other Options

-machineId

This option prints your machine ID.

-encodepass <your password>

This option prints an encoded password that can be used in the .properties configuration file.

-workspace <path>

This option specifies the path to a custom location of the .jtest directory, where run-specific data is stored during analysis.

-showdetails

This option increases console verbosity to display progress details.

-autoconfig <project name@server_name:port>

This option specifies a project stored on DTP that includes configuration settings. With this option enabled, Jtest is automatically configured with the settingst stored in the specified DTP project and does not need to be configured in a locally stored .properties file.

(info) Use the -property option to provide the credentials required to authenticate on DTP.

Example:

-autoconfig [email protected]:8080 -property dtp.user=user1 -property dtp.password=myPassword1

-fail

This option fails the command by returning a non-zero exit code if violations or setup problems are reported (see Command Line Exit Codes for details about exit codes returned if the process fails).

-version

This option prints information about the version of the Parasoft tool you are using.

-help

This option prints the command line help.

  • No labels