In the 'Custom conversion format' field, enter json that describes how to convert tests from raw format to the format of your testing framework.
After conversion, the result is injected to the "testsToRunConverted" parameter.
Note: Click "Validate" to check the correctness of the inserted configuration.
The following are the components that you can use in the "Custom conversion format" :
- testPattern - describes the pattern for converting single test. All parameters that needs to be replaced be real test data, should start with $, for example $package, $class, $testName, $externalRunId, $myCustomParam. All other characters in the pattern will appear in the final result as is.
- testDelimiter - the delimiter used to separate different tests.
- prefix - a prefix for the whole conversion result.
- suffix - a suffix for the whole conversion result.
- testsToRunConvertedParameter - the parameter name that will contain the conversion result. Default value is "testsToRunConverted".
- replacements - the array of replace methods.
The 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 of myPackage1 for the first test and myPackage2 for the second test.
- $class variable will get a value of myClass1 for the first test and myClass2 for the second test.
- $testName variable will get a value of myTest1 for the first test and myTest2 for the second test.
The testsToRunConverted parameter will be equal: myPackage1.myClass1#myTest1,myPackage2.myClass2#myTest2
Optional:
There is a possibility to alter values received from ALM Octane, for example to set lowercase 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 the 'Custom conversion format' json.
"replacements": [
{
"type": "replaceRegex",
"target": "$package|$class|$testName",
"regex": "aaa",
"replacement": "bbb",
"description": "Replaces all the sequence of characters matching the regex with a 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."
}]