Introduction
You can automatically create "smart" API tests from a recorded traffic file. Smart API tests are tests that are automatically configured using the same advanced Smart Test Generator technology used in the Parasoft Recorder. An Advanced Test Generator license is required. See Licensing for Advanced Test Generator license options.
Add a new test suite and choose Traffic > Generate Smart API Tests in the creation wizard. See Adding Projects, .tst files, and Test Suites for details on using traffic wizards.
- Specify the traffic file and choose the application type when prompted. The Application type field shows configuration files stored in the
<WORKSPACE>/TestAssets/test_templatesdirectory. See Creating Smart Test Templates for additional information about the configuration files for smart API test generation. - Review and adjust your tests to meet your current testing goals.
Test Creation Properties
You can define additional test creation properties in the tst_creation.properties configuration file. The tst_creation.properties file is located in the SOAtest workspace under the TestAssets/test_templates folder. By default, all web proxies that connect to the SOAtest server will use the settings configured in this file.
You can create multiple instances of the file and customize the configurations so that SOAtest can generate smart tests that help you achieve your testing goals. If you create different instances of the tst_creation.properties file, you can specify unique names with the applicationType property so that SOAtest interfaces can distinguish between different instances of the configurations (see Creating Smart API Tests from Traffic).
| applicationType | Defines a unique identifier for the configuration file so that it can be read from different SOAtest interfaces, such as the Generate Smart API Traffic wizard (see Creating Smart API Tests from Traffic). |
|---|---|
| includeContentTypes | Defines a comma-separated list of content types to include during traffic processing. Default is application/json,application/x-www-form-urlencoded |
| excludeContentTypes | Defines 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 |
| disableDiffParameterization | Enables/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. |
| disableEnvironmentCreation | Enables/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 |
| disableAssertorCreation | Enables/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 You can specify additional name patterns by adding properties and appending them with For example:
|
| diffToolIgnoreValues.<number> | Defines a regex matching values that should be ignored when creating diffs. Default is to ignore timestamps:
You can specify additional value patterns by adding properties and appending them with For example:
|
| assertorToolIgnoreQueryParameterNames.<number> | Defines a regex-matching query parameter name that should be ignored when creating JSON Assertor tools. Default is to ignore query names starting with "maxResultsSize":
The property is not case sensitive. You can specify additional patterns by adding properties and appending them with |
| 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:
You can specify additional patterns by adding properties and appending them with |
| 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:
The property is not case sensitive. You can specify additional patterns by adding properties and appending them with |
| assertorToolIgnoreFieldValues.<number> | Defines a regex matching values that should be ignored when creating JSON Assertor tools. Default is to ignore timestamps:
You can specify additional value patterns by adding properties and appending them with For example:
|
| 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. The following examples describe common scenarios:
# include URLs that have a 'path' segment
|
| 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. The following examples describe common scenarios:
|
includeTextResponseValues.<number> | Defines a regular expression matching values that the test generator will consider for potential extraction to a data bank. If a match is found, the substring that matches the pattern enclosed in the parentheses will be considered. At least one set of parentheses is required to define the desired value and its boundaries. Two parameters are configured with the following regex patterns by default:
|
| includeTextResponseContentTypes | Defines a comma-separated list of content types the test generator will process against the includeTextResponseValues parameter. Default is text/html. |
| requestPayloadParameterizationExcludeNames.<number> | Defines a regex that matches field names in a request payload that should be excluded from parameterization. The following example excludes date and time field names from parameterization:
|
| requestQueryStringParameterizationExcludeNames.<number> | Defines a regex that matches field names in request queries that should be excluded from parameterization. The following example excludes date and time field names from parameterization:
|
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. |
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/*
# Exclude from being parameterized field names in request payload
requestPayloadParameterizationExcludeNames.1=(?i)^(time|date).*
Upgrading SOAtest
When SOAtest is upgraded to a newer version, the existing tst_creation.properties file will be prepended with any new parameters included with the release and flagged with a version number. For example:
version=2
# ====== SOAtest 2020.2 RELEASE UPDATES ======
# Consider values in text responses as candidates to be databanked based on matching pattern.
# If a match is found, extract the substring that matches the pattern enclosed by the parentheses as the candidate.
# At least one pair of parentheses is required; otherwise, no value will be extracted.
includeTextResponseValues.1="([-A-Za-z0-9%_=+./]{10,})"
includeTextResponseValues.2='([-A-Za-z0-9%_=+./]{10,})'
# Consider only these text response types for extracting response values
includeTextResponseContentTypes=text/html
# ====== PREVIOUSLY CONFIGURED SETTINGS ======
includeContentTypes=application/json, application/x-www-form-urlencoded
#excludeContentTypes=
#disableDiffCreation=false
#disableDiffParameterization=false
#disableEnvironmentCreation=false
#disableDataBankCreation=false
#disableAssertorCreation=false
# Ignore values that start with "time", "date", "url" or "href" in diff tool, case insensitive
...
If the existing file is moved or deleted, all default settings, as well as new settings added from the latest update, will be applied. A back up of the original file will be applied with a .bak extension.