morciani
16 years agoOccasional Contributor
parsing text strings with Groovy script
Hello- I am new to Groovy script. I have inserted the following property expansion / simple Groovy script into a soapUI Test Request:
...
${=context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()}
...
This works great, as my current Test Step name is inserted into my request like this:
...
01_R3_AK2_2772 ...
Next, I have an element that I want to populate with a substring found within this string, like this:
...
AK
...
I've tried various variations like below, all without any luck.
...
${=MID(context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel(),7,2)}
...
I am sure I am missing something. Any help in pointing out how I can parse strings with Groovy script is appreciated... Could someone point me to some examples?
...
...
This works great, as my current Test Step name is inserted into my request like this:
...
Next, I have an element that I want to populate with a substring found within this string, like this:
...
...
I've tried various variations like below, all without any luck.
...
...
I am sure I am missing something. Any help in pointing out how I can parse strings with Groovy script is appreciated... Could someone point me to some examples?