Custom configuration is json that describes how to convert tests in raw format to the format of your testing framework.
After conversion, result is injected to the "testsToRunConverted" parameter.
Note : In "Advanced" section you can validate correctness of the inserted configuration.
Here are properties of the custom configuration
- testPattern - describes pattern for converting single test. It uses reserved words ($package,$class,$testName) that will be
replaced by real test data. All other characters in pattern will appear as is in final result
- testDelimiter - the delimiter used to separate different tests
- prefix - the prefix for whole conversion result
- suffix - the suffix for whole conversion result
- testsToRunConvertedParameter - the parameter name to set conversion result to. Default value is “testsToRunConverted”
- replacements - the array of replace methods
Minimal configuration is:
{
"testPattern": "$package.$class#$testName",
"testDelimiter": ","
}
For example:
The testsToRun parameter received 2 tests separated by a semicolon: v1:myPackage1|myClass1|myTest1;myPackage2|myClass2|myTest2
The defined testPattern is: $package.$class#$testName
The defined testDelimiter is: ,
- $package variable will get a value: myPackage1 for first test and myPackage2 for second one
- $class variable will get a value: myClass1 for first test and myClass2 for second one
- $testName variable will get a value: myTest1 for first test and myTest2 for second one
The testsToRunConverted will be equal: myPackage1.myClass1#myTest1,myPackage2.myClass2#myTest2
There is possibility to alter values that received from ALM Octane, for example set lower case to the testName,replace spaces by '_', and so on.
Here are examples of available replace methods. Each replace method contains "target" property that define what parts of the test pattern are affected by replace method,
available values are $package,$class,$testName. Its possible to put several values separated by '|'. The replacements are executed in the order they appear in configuration json.
"replacements": [
{
"type": "replaceRegex",
"target": "$package|$class|$testName",
"regex": "aaa",
"replacement": "bbb",
"description": "Replaces all the sequence of characters matching regex by replacement string."
},{
"type": "replaceRegexFirst",
"target": "$package|$class|$testName",
"regex": "aaa",
"replacement": "bbb",
"description": "Replaces the first substring that matches the given regex with the given replacement."
},{
"type": "replaceString",
"target": "$package|$class|$testName",
"string": "xxx",
"replacement": "yyy",
"description": "Replaces all occurrences of ‘string’ with ‘replacement’."
},{
"type": "joinString",
"target": "$package|$class|$testName",
"prefix": "xxx",
"suffix": "yyy",
"description": "Add prefix and suffix to the test template."
},{
"type": "toLowerCase",
"target": "$package|$class|$testName",
"description": "Convert test template to lower case."
},{
"type": "toUpperCase",
"target": "$package|$class|$testName",
"description": "Convert test template to upper case."
},{
"type": "notLatinAndDigitToOctal",
"target": "$package|$class|$testName",
"description": "Replaces all non-latin characters and digits ^[a-zA-Z0-9] to their ASCII octal value."
}]