Forum Discussion
So here is the solution for incrementing a parameter in a payload xml file, two requisites to the Groovy are:
* A Property needs to be defined, in this use case it was called "incrementValue"
* The value in-question needs to be 'parameterized', I'm 'P-izing' ReferenceId as follows:
<req:ReferenceId>${Properties#incrementValue}</req:ReferenceId> // Calls the Pre-set Property "incrementValue
and finally only four lines of script are required:
def incrementValue = context.expand('${Properties#incrementValue}');
incrementValue=incrementValue.toInteger() + 1;
incrementValue=incrementValue.toString();
log.info "incrementValue: " + incrementValue; // Optional as this simply prints the text in the groovy editor
testRunner.testCase.getTestStepByName("Properties").setPropertyValue("incrementValue",incrementValue);
I'm labeling this solution as solved, much thanks to Ritchie and others who provided valuable feed-back during the past two weeks.
Cheers, wiseAcre
Related Content
Recent Discussions
- 4 days agominhng