Extract certain strings from JSON data strucure
- 7 years ago
Hello Markus,
Given that you have a list of values that can vary between 0 and infinity, you can set properties from it easily enough, but now you have to give the property a name for each of those values. For each value a unique name must be created unless you don't care about how many values are in a list. The following builds on prior examples in this thread:
filteredInterfaceNameList = [];
interfaceNameList.each { name ->
if (name.contains('cons')) {
filteredInterfaceNameList.add (name)
};
};
filteredInterfaceNameList.eachWithIndex { interfaceName, idx ->
propName = "somePropertyNameValue" + idx.toString();
propValue = interfaceName;
testRunner.testCase.testSteps["Properties"].setPropertyValue( propName, propValue);
};.
.
.
You have never stated how you would use this dynamically, so I can only imagine... The above code allows you to dynamically write properties from 0 to infinity (or however many Smartbear will allow). :)