You can configure the proxy port, specify test creation options, and access the API so that the tool can be used in automated workflows. In this section:

Proxy System Properties

You can configure the web proxy by specifying system properties in the Manage Web Proxy console or from the command line when executing the .jar file. You can specify the following properties:  

-DapiPortSystem property that specifies the API port number. Default is 40090.
-DproxyPortStart

System property that specifies the starting port number when scanning for an open port. Default is 40443.

-DproxyPortRange

System property that limits the number of ports scanned after the starting port number (value specified with the proxyPortStart argument). Set to 0 to prevent scanning.

-DuseSystemProxy

System property that enables using the network-level proxy. Default is true.

-DdebugEnables/disables system debugging information. Default is false.

Manage Web Proxy Example

Add the system properties to the Java Options field in the Java tab. The following example sets the API port to 45000 and enables debugging:

Command Line Example

Specify the configuration options on startup from the command line. The following startup command sets the API port to 10090, scans for a range of port numbers, and enables debugging:

%INSTALLDIR%/jre/bin/java -DapiPort=10080 -DproxyPortStart=20443 -DproxyPortRange=10 -Ddebug=true -jar com.parasoft.traffic.proxy.jar

Java Support

The Smart API Test Generator ships with its own instance of Java, but you can use any Java 8 or later that is already installed on your system.

Test Creation Properties

You can determine how the recorder generates tests by defining properties in the tst_creation.properties configuration file. The tst_creation.properties file is located in the workspace under the TestAssets folder. By default, all web proxies that connect to the SOAtest server will use the settings configured in this file. 

An instance of the tst_creation.properties file also ships with the web proxy installed on a local machine. You can configure the settings in the local file to override settings configured in the tst_creation.properties file on the SOAtest server by setting the useServerSettings property to false (see useServerSettings). If you want to use the local settings, make sure that the tst_creation.properties file is in the same directory as the com.parasoft.traffic.proxy.jar file so that it can automatically be read during test creation.

If the tst_creation.properties file is moved or deleted, all default settings will be applied. 

includeContentTypesDefines a comma-separated list of content types to include during traffic processing. Default is application/json,application/x-www-form-urlencoded
excludeContentTypesDefines a comma-separated list of content types to exclude during traffic processing. Default is empty.
disableDiffCreation

Enables/disables diff creation. See Diff for additional information. Default is false.

disableDiffParameterizationEnables/disables diff parameterization. Parameterization enables you to use data banked values in the diff. If diff parameterization is disabled (setting this property to true), only static values will be available. Default is false.
disableEnvironmentCreationEnables/disables the creation of an environment and environment variables. Default is false.
disableDataBankCreation

Enables/disables data bank creation. See Data Exchange Tools for additional information. Default is false.

disableAssertorCreationEnables/disables the creation of JSON Assertor tools. Default is false. See JSON Assertor for additional information.
diffToolIgnoreNames.<number>

Defines a regex matching element names that should be ignored when creating diffs. Default is (?i)^(time|date|url|href).*

You can specify additional name patterns by adding properties and appending them with .<number>.

For example:

diffToolIgnoreNames.1=<name_pattern_1>

diffToolIgnoreNames.2=<name_pattern_3>

diffToolIgnoreNames.3=<name_pattern_3>

diffToolIgnoreValues.<number>

Defines a regex matching values that should be ignored when creating diffs. Default is to ignore timestamps:

[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,3})?(([+-][0-9]{2}:[0-9]{2})|Z)?

You can specify additional value patterns by adding properties and appending them with .<number>.

For example:

diffToolIgnoreValues.1=<value_pattern_1>

diffToolIgnoreValues.2=<value_pattern_3>

diffToolIgnoreValues.3=<value_pattern_3>

assertorToolIgnoreQueryParameterNames.<number>

Defines a regex matching query parameter names that should be ignored when creating JSON Assertor tools.

Default is to ignore query names starting with "maxResultsSize":

(?i)^(maxResultSize).*

The property is not case sensitive.

You can specify additional patterns by adding properties and appending them with .<number>.

assertorToolIgnoreQueryParameterValues.<number>

Defines a regex matching query parameters values that should be ignored when creating JSON Assertor tools.

Ignore query parameters when creating assertions based on parameter value pattern

Default is to ignore timestamps:

[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,3})?(([+-][0-9]{2}:[0-9]{2})|Z)?

You can specify additional patterns by adding properties and appending them with .<number>.

assertorToolIgnoreFieldNames.<number>

Defines a regex matching values in the response payload that should be ignored when creating JSON Assertor tools. Default value is to ignore values in response payload that starts with time, date, url, href, SessionId, or transactionId.

Default is to ignore timestamps:

(?i)^(time|date|url|href|SessionId|transactionId).*

The property is not case sensitive.

You can specify additional patterns by adding properties and appending them with .<number>.

assertorToolIgnoreFieldValues.<number>

Defines a regex matching values that should be ignored when creating JSON Assertor tools. Default is to ignore timestamps:

[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,3})?(([+-][0-9]{2}:[0-9]{2})|Z)?

You can specify additional value patterns by adding properties and appending them with .<number>.

For example:

assertorToolIgnoreFieldValues.1=<value_pattern_1>

assertorToolIgnoreFieldValues.2=<value_pattern_3>

assertorToolIgnoreFieldValues.3=<value_pattern_3>

includeURLPatterns

Defines a comma-separated list of resource URL patterns to include for test generation. You can define case-sensitive patterns using Ant-style syntax. Default is to include all URLs.

In the following example, all URLs in the parasoft.com domain will be included:

includeURLPatterns=*.parasoft.com

excludeURLPatterns

Defines a comma-separated list of resource URL patterns to exclude from test generation. You can define case-sensitive patterns using Ant-style syntax. Default is to include all URLs.

In the following example, all URLs at port 8443 in the parasoft.com domain will be excluded:

excludeURLPatterns=*.parasoft.com:8443

useServerSettings

Enables/disables using the settings from the tst_creation.properties file on the SOAtest server, instead of the settings configured in the local tst_creation.properties file. Default is true.
Example tst_creation.properties File
includeContentTypes=application/json, application/x-www-form-urlencoded
excludeContentTypes=image/png,font/ttf,text/css,application/javascript
disableDiffCreation=false
disableDiffParameterization=false
disableEnvironmentCreation=false
disableDataBankCreation=false
disableAssertionCreation=true
# Ignore values that start with "time", "date", "url" or "href" in diff tool, case insensitive
diffToolIgnoreNames.1=(?i)^(time|date|url|href).*
# Ignore values that end with "time", "date", "url" or "href" in diff tool, case insensitive
diffToolIgnoreNames.2=(?i).*(time|date|url|href)$
# Ignore values like a timestamp in diff tool, e.g. 2018-03-21T07:00:00.000Z
diffToolIgnoreValues.1=[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,3})?(([+-][0-9]{2}:[0-9]{2})|Z)?
# Ignore query parameters when creating assertions based on parameter name pattern
assertorToolIgnoreQueryParameterNames.1=(?i)^(maxResultSize).*
# Ignore query parameters when creating assertions based on parameter value pattern
assertorToolIgnoreQueryParameterValues.1=[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{1,3})?(([+-][0-9]{2}:[0-9]{2})|Z)?
# Ignore fields in payload when creating assertions based on field name pattern
assertorToolIgnoreFieldNames.1=(?i)^(time|date|url|href|SessionId|transactionId).*
# Ignore fields in payload when creating assertions based on field value pattern
assertorToolIgnoreFieldValues.1=[0-9]\{4}-[0-9]\{2}-[0-9]\{2}T[0-9]\{2}:[0-9]\{2}:[0-9]\{2}([.][0-9]\{1,3})?(([+-][0-9]\{2}:[0-9]\{2})|Z)?
# Comma separated list of URL patterns where pattern matching is the same as Apache Ant. URLs can be case sensitive.
includeURLPatterns=http://{host}:8080/path/**/resources/*
excludeURLPatterns=https://{host}:8443/path/**/resources/*

Using the API

After starting the web proxy, you can go to the following URL to review the API defintions:

http://<host>:<port>/api/openapi.json

Training the Smart Test Generator

See Training the Smart API Test Generator for information about teaching the Smart Test Generator how to create tests for your project.

  • No labels