Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section provides information about the Jtest goals tasks for Gradle and their parameters. The following goals tasks are available:

Table of Contents
maxLevel1

Anchor
jtest
jtest
jtest

Compilation - Compilation TypeResources - List TypeExclude - String Type
Table of Content Zone
maxLevel2
minLevel2
locationtop
typeflat
separatorpipe

The Gradle task to execute Jtest.

Attributes

NameAccepted values / data typeDescriptionRequired
compilationCompilation

A description of manual configuration data (see Manual Customization of Compilation Data)

No
compilations
compilationsListA list of descriptions of manual configuration data (see Manual Customization of Compilation Data)No
dataUpdateString

Allows you to manually update compilation data collected from the build.

User property is: jtest.dataUpdate

No
Jtest Goals Reference for Gradle
configString

The name of a built-in, DTP, or user-defined test configuration.

User property is: jtest.config

No
excludeString

Specifies a subset of files or packages from the selected resources that will be excluded from analysis. You can provide the qualified names or use Ant glob patterns to match more filenames.

User property is: jtest.exclude

No
excludesList

A list of exclude parameters.

User property is: jtest.excludes

No
excludeTestSourcestrue | false

Excludes test source code from analysis.

User property is: jtest.excludeTestSources.

No
failtrue | false

Fails the build if any violation is reported.

Default value is: false

User property is: jtest.fail

No
homePath

Specifies the Jtest installation directory. If not defined, the Jtest location specified on PATH will be used.

User property is: jtest.home

Recommended
ignoredIdsList

A list of ignored compilation IDs.

User property is: jtest.ignoredids

No
includeString

Specifies a subset of files or packages form the selected resources that will be included during analysis.

User property is: jtest.include

No
includesList

A list of include parameters.

User property is: jtest.includes

No
publishtrue | falseEnables reporting results of local analysis to the DTP server.

User property is: jtest.publish

No
reportPath

Specifies the directory where the report will be created.

User property is: jtest.report

No
resourceString

Specifies the input scope for analysis. If no resources are specified, Jtest will analyze resources from every built project.

User property is: jtest.resource

No
resourcesList

A list of resource parameters.

User property is: jtest.resources

No
settingsPath

An absolute or relative path to the *properties file that includes custom configuration settings.

User property is: jtest.settings

No
settingsListList

A list of settings parameters.

User property is: jtest.settingsList

No
showDetailstrue | false

Displays detailed progress information.

User property is: jtest.showdetails

No
showSettingstrue | false

Prints the current settings and customizations along with the information where each of them is configured (e.g. in the jtest.properties file).

User property is: jtest.showsettings

No
projectNameTemplateString

The project name template. This parameter allows you to configure the pattern with the options [group], [name], [version], [path], and [basedir].

User property is: jtest.projectNameTemplate

No
skiptrue | false

Allows you to skip the Jtest execution phase. If set to true, only the jtest.data.json data file is generated.

User property is: jtest.skip

No

Parameter Details

Anchor
config
config
config

The name of a test configuration. The following configuration types are supported:

  • built-in test configurations, for example "builtin://Recommended Rules"
  • dtp test configurations, for example "dtp://New Config"
  • user-defined test configurations, for example "user://Your Config"

User-defined test configurations should be stored in the [INSTALL_DIR]/configs/user directory as *.properties files.


Anchor
dataUpdate
dataUpdate
dataUpdate

Allows you to manually update compilation data collected from the build.

  • Supported actions: prepend, append, and set.
  • Supported data types: classpath, bootpath, sourcepath, binarypath, sourcecode (set only) and encoding (set only)
  • Scope: all collected projects data will be updated

See Manual Customization of Compilation Data and Compilation Data Model for more information.

Anchor
exclude
exclude
exclude

Specifies a subset of files or packages from the selected resources that will be excluded from analysis. You can provide the qualified names. You can use glob patterns to match more filenames.

Example 1: The following pattern excludes all files from com.parasoft package and its sub-packages: /com/parasoft/**

Example 2: The following pattern excludes all files from the package com.parasoft.jtest, but NOT from its sub-packages: /com/parasoft/jtest/*

Example 3: The following pattern excludes all files from the given directory and all subdirectories: path:/home/user/project/src/test/java/**

Anchor
include
include
include

Specifies a subset of files or packages form the selected resources that will be included during analysis. You can use glob patterns to match more filenames.

Example 1: The following pattern includes all files from com.parasoft package and its sub-packages: /com/parasoft/**

Example 2: The following pattern includes all files from the package com.parasoft.jtest, but NOT from its sub-packages: /com/parasoft/jtest/*

Example 3: The following pattern includes all files from the given directory and all subdirectories: path:/home/user/project/src/test/java/**

Anchor
resource
resource
resource

Specifies the input scope for analysis. If no resources are specified, Jtest will analyze resources from every built project.

Use the following pattern to specify the paths: ${ProjectName}/my/src/dir/my/package/file.java". You can use the following wildcards:

  • ? - matches one character
  • * - matches zero or more characters, except the path separator (the / character)
  • ** - matches entire paths, including the path separator (the / character)

Anchor
settings
settings
settings

An absolute or relative path to the *properties file that includes custom configuration settings.

Info
iconfalse

Some of the setting names may not be consistent with the settings dedicated for the build system plugins. See Configuration Settings for details.

Anchor
projectNameTemplate
projectNameTemplate
projectNameTemplate

The project name template. By default, the following pattern is used to create project names in json: "group:name". This parameter allows you to configure the pattern with the options [group], [name], [version], [path], and [basedir], for example, to make a project name compatible with the project name in Eclipse.

Warning
iconfalse

If you change the pattern for a project that has already been integrated with DTP, DTP will not recognize your project. It will assume that your project after the change of the pattern is a different project. For details, see the DTP documentation.

Parameter Type Details

The following examples assume that the Jtest Plugin for Gradle has been properly configured and applied in the Gradle build script; see Configuring the Jtest Plugin for Gradle.

Anchor
compilation_type
compilation_type
Compilation Type

  • Attribute: Compilation
  • A nested object
Code Block
jtest {
    home = "path/to/jtest"
    compilation {
        id = "main"
        override = true
    }
}

Anchor
list_type
list_type
List Type

  • Attribute: resources
  • Specifies the list of resource patterns to match against resources that are collected during the build.
Code Block
jtest {
        home = "path/to/jtest"
        resources = [
                "**.java
.lang.String
  • Since: 1.0.0
  • Required: No
  • User property: jtest.config
  • Parameter Type Details

    Anchor
    compilation_typecompilation_type
    Anchor
    list_typelist_type
    Anchor
    string_typestring_type

    jtest-agent

    jtest-monitor

    ",
                    "myGradleProjectName/src/com/mycompany/models/**/*.properties"
            ]
    }

    Anchor
    string_type
    string_type
    String Type

    • Attribute: Exclude
    • Specifies a subset of files or packages from the selected resources that will be excluded from analysis.
    Code Block
    jtest {
        home = "path/to/jtest"
        exclude = "com/mycompany/models/**/NotInteresting*.properties"
    }

    See Compilation Data Model for more information.

    Anchor
    jtest_agent
    jtest_agent
    jtest-agent

    Table of Content Zone
    maxLevel2
    minLevel2
    locationtop
    typeflat
    separatorpipe

    The Gradle task to collect coverage with Jtest.

    Parameters

    NameAccepted values / data typeDescriptionRequired
    homePath

    Jtest installation directory.

    User property is: jtest.home

    Yes
    skiptrue | false

    Allows you to skip the Jtest tasks.

    Default value is: false

    User property is: jtest.skip

    No
    runtimeDataLocationPath

    The path to the file where coverage runtime data will be stored.

    User property is: jtest.runtimeDataLocation

    No
    metadataLocationPath

    The path to the file where coverage metadata data will be stored.

    User property is: jtest.metadataLocation

    No
    coverage

    A set of parameters that allow you to configure collecting coverage.

    • jtest.coverage.skip - Disables collecting coverage.
    • jtest.coverage.includes - <Glob> patterns to include classes. Coverage information will be collected.
    • jtest.coverage.excludes - <Glob> patterns to exclude classes. Coverage information will not be collected.
    • jtest.coverage.testIncludes - <Glob> patterns to include test classes. Test cases will be assigned with coverage.
    • jtest.coverage.testExcludes - <Glob> patterns to exclude test classes. Test cases will not be assigned with coverage.
    No

    Parameter Details

    Anchor
    coverage
    coverage
    coverage

    The default is:

    Code Block
    jtest { 
      /* other parameters  */ 
      coverage { 
        skip = false 
        includes = [ 'package/**' ] 
        excludes = [ ] 
        testIncludes = [ 'package/Test.class' ] 
        testExcludes = [ ] 
      } 
    }

    Anchor
    runtimeDataLocation
    runtimeDataLocation
    runtimeDataLocation

    The default is: ${basedir}/parasoft/jtest-instrument/runtimedata.data

    Anchor
    metadataLocation
    metadataLocation
    metadataLocation

    The default is: ${basedir}/parasoft/jtest-instrument/metadata.data

    jtest-monitor

    Table of Content Zone
    maxLevel2
    minLevel2
    locationtop
    typeflat
    separatorpipe

    This task scans the build to generate settings for the Jtest Java Agent, and creates a monitor package in location specified with the monitorLocation parameter.

    The monitor package contains the following:

    • static_coverage.xml - the file that contains static coverage information
    • agent.jar - the Jtest Java coverage agent jar archive
    • agent.properties - the agent settings file that contains scope parameters generated during the build process and other attributes
    • agent.sh/agent.bat - the script that generates the Jtest Java agent VM arguments necessary to monitor the application
    Info
    iconfalse
    titleCommand Line Execution

    Ensure that tests and classes are compiled before executing the jtest:monitor task from command line (the compile phase).

    Info
    iconfalse
    titleExcluding test classes

    Gradle does not recognize test classes when the jtest-monitor task is run. To ensure that coverage information for test classes is not collected, it is highly recommended to use jtest.exclude and specify the path to the package that contains test, for example -Djtest.exclude=path:**/test/**.

    Parameters

    NameAccepted values / data typeDecriptionRequired
    agentServerEnabledtrue | false

    A switch that allows you to enable the Agent server.

    User property is: jtest.agentServerEnabled

    No
    autostartAgenttrue | false

    A switch to automatically enable collecting coverage.

    User property is: jtest.autostartAgent

    No
    compilationCompilationA description of manual configuration data (see Manual Customization of Compilation Data)No
    coverage

    A set of parameters that allow you to configure collecting coverage.

    • jtest.coverage.skip - Disables collecting coverage.
    • jtest.coverage.includes - <Glob> patterns to include classes. Coverage information will be collected.
    • jtest.coverage.excludes - <Glob> patterns to exclude classes. Coverage information will not be collected.
    • jtest.coverage.testIncludes - <Glob> patterns to include test classes. Test cases will be assigned with coverage.
    • jtest.coverage.testExcludes - <Glob> patterns to exclude test classes. Test cases will not be assigned with coverage.

    excludeString

    Specifies a subset of files or packages from the selected resources that will be excluded from analysis. You can provide the qualified names or use Ant glob patterns to match more filenames.

    User property is: jtest.exclude

    No
    excludesList

    A list of exclude parameters.

    User property is: jtest.excludes

    No
    homePath

    Jtest installation directory.

    User property is: jtest.home

    Recommended
    ignoredIdsList

    A list of ignored compilation IDs.

    User property is: jtest.ignoredids

    No
    includeString

    Specifies a subset of files or packages form the selected resources that will be included during analysis.

    User property is: jtest.include

    No
    includesList

    A list of include parameters.

    User property is: jtest.includes

    No

    Anchor
    monitorLocation
    monitorLocation
    monitorLocation

    Path

    The path to the location where the monitor package will be created.

    User property is: jtest.monitorLocation

    No
    publishtrue | falseEnables reporting results of local analysis to the DTP server.

    User property is: jtest.publish

    No
    reportPath

    Specifies the directory where the report will be created.

    User property is: jtest.report

    No
    resourceString

    Specifies the input scope for analysis. If no resources are specified, Jtest will analyze resources from every built project.

    User property is: jtest.resource

    No
    resourcesList

    A list of resource parameters.

    User property is: jtest.resources

    No
    settingsPath

    An absolute or relative path to the *properties file that includes custom configuration settings.

    User property is: jtest.settings

    No
    settingsListList

    A list of settings parameters.

    User property is: jtest.settingsList

    No
    showDetailstrue | false

    Displays detailed progress information.

    User property is: jtest.showdetails

    No
    showSettingstrue | false

    Prints the current settings and customizations along with the information where each of them is configured (e.g. in the jtest.properties file).

    User property is: jtest.showsettings

    No
    projectNameTemplateString

    The project name template. This parameter allows you to configure the pattern with the options [group], [name], [version], [path], and [basedir].

    User property is: jtest.projectNameTemplate

    No
    skiptrue | false

    Allows you to skip the Jtest execution phase. If set to true, only the jtest.data.json data file is generated.

    User property is: jtest.skip

    No

    Parameter Details

    Anchor
    exclude_2
    exclude_2
    exclude

    Specifies a subset of files or packages from the selected resources that will be excluded from analysis. You can provide the qualified names. You can use glob patterns to match more filenames.

    Example 1: The following pattern excludes all files from com.parasoft package and its sub-packages: /com/parasoft/**

    Example 2: The following pattern excludes all files from the package com.parasoft.jtest, but NOT from its sub-packages: /com/parasoft/jtest/*

    Example 3: The following pattern excludes all files from the given directory and all subdirectories: path:/home/user/project/src/test/java/**

    Anchor
    #include_2
    #include_2
    include

    Specifies a subset of files or packages form the selected resources that will be included during analysis. You can use glob patterns to match more filenames.

    Example 1: The following pattern includes all files from com.parasoft package and its sub-packages: /com/parasoft/**

    Example 2: The following pattern includes all files from the package com.parasoft.jtest, but NOT from its sub-packages: /com/parasoft/jtest/*

    Example 3: The following pattern includes all files from the given directory and all subdirectories: path:/home/user/project/src/test/java/**

    Anchor
    resource_2
    resource_2
    resource

    Specifies the input scope for analysis. If no resources are specified, Jtest will analyze resources from every built project.

    Use the following pattern to specify the paths: ${ProjectName}/my/src/dir/my/package/file.java". You can use the following wildcards:

    • ? - matches one character
    • * - matches zero or more characters, except the path separator (the / character)
    • ** - matches entire paths, including the path separator (the / character)

    Anchor
    settings_2
    settings_2
    settings

    An absolute or relative path to the *properties file that includes custom configuration settings.

    Info
    iconfalse

    Some of the setting names may not be consistent with the settings dedicated for the build system plugins. See Configuration Settings for details.

    Anchor
    projectNameTemplate_2
    projectNameTemplate_2
    projectNameTemplate

    The project name template. By default, the following pattern is used to create project names in json: "group:name". This parameter allows you to configure the pattern with the options [group], [name], [version], [path], and [basedir], for example, to make a project name compatible with the project name in Eclipse.

    Warning
    iconfalse

    If you change the pattern for a project that has already been integrated with DTP, DTP will not recognize your project. It will assume that your project after the change of the pattern is a different project. For details, see the DTP documentation.

    Parameter Type Details

    The following examples assume that the Jtest Plugin for Gradle has been properly configured and applied in the Gradle build script; see Configuring the Jtest Plugin for Gradle.

    Anchor
    compilation_type_2
    compilation_type_2
    Compilation Type

    • Attribute: Compilation
    • A nested object
    Code Block
    jtest {
        home = "path/to/jtest"
        compilation {
            id = "main"
            override = true
        }
    }

    Anchor
    list_type_2
    list_type_2
    List Type

    • Attribute: resources
    • Specifies the list of resource patterns to match against resources that are collected during the build.
    Code Block
    jtest {
            home = "path/to/jtest"
            resources = [
                    "**.java",
                    "myGradleProjectName/src/com/mycompany/models/**/*.properties"
            ]
    }

    Anchor
    string_type_2
    string_type_2
    String Type

    • Attribute: Exclude
    • Specifies a subset of files or packages from the selected resources that will be excluded from analysis.
    Code Block
    jtest {
        home = "path/to/jtest"
        exclude = "com/mycompany/models/**/NotInteresting*.properties"
    }

    See Compilation Data Model for more information.

    Anchor
    jtest_instrument
    jtest_instrument
    jtest-instrument (deprecated)

    Table of Content Zone
    maxLevel2
    minLevel2
    locationtop
    typeflat
    separatorpipe

    The Jtest offline instrumentation task.

    Parameters

    NameAccepted values / data typeDescriptionRequired
    homePath

    Jtest installation directory.

    User property is: jtest.home

    Yes
    skiptrue | false

    Allows you to skip the Jtest tasks.

    Default value is: false

    User property is: jtest.skip

    No
    runtimeDataLocationPath

    The path to the file where coverage runtime data will be stored.

    User property is: jtest.runtimeDataLocation

    No
    metadataLocationPath

    The path to the file where coverage metadata data will be stored.

    User property is: jtest.metadataLocation

    No
    coverage

    A set of parameters that allow you to configure collecting coverage.

    • jtest.coverage.skip - Disables collecting coverage.
    • jtest.coverage.includes - <Glob> patterns to include classes. Coverage information will be collected.
    • jtest.coverage.excludes - <Glob> patterns to exclude classes. Coverage information will not be collected.
    • jtest.coverage.testIncludes - <Glob> patterns to include test classes. Test cases will be assigned with coverage.
    • jtest.coverage.testExcludes - <Glob> patterns to exclude test classes. Test cases will not be assigned with coverage.
    No

    Parameter Details

    Anchor
    runtimeDataLocation_2
    runtimeDataLocation_2
    runtimeDataLocation

    The default is: ${basedir}/parasoft/jtest-instrument/runtimedata.data

    Anchor
    metadataLocation_2
    metadataLocation_2
    metadataLocation

    The default is:${basedir}/parasoft/jtest-instrument/metadata.data

    Anchor
    coverage_2
    coverage_2
    coverage

    The default is:

    Code Block
    jtest { 
      /* other parameters  */ 
      coverage { 
        skip = false 
        includes = [ 'package/*' ] 
        excludes = [ ] 
        testIncludes = [ 'pacakge/Test.class' ] 
        testExcludes = [ ] 
      } 
    }

    ...