Apologies, I don't know Groovy, I am a one-trick java-pony.
My understanding is your
"Output Log Message" step outputs an xml-snippet:
<name_detail>
<name>{{property value}}</name>
</name_detail>
So, this snippet is stored in property
lisa.Output Log Message.rspAnd
{{property value}} is already parsed and replaced by a real value.
For concatening the snippet x number of times and storing the result in another property, I would add a Scripted Assertion step to the "Output Log Message" step. Configure the assertion to fire when "false"
Then add following script
String snippet = testExec.getStateValue("lisa.Output Log Message.rsp");
// Hardcode the value of how many loops
int n = 10;
// If you want to grab that value from a property (eg. loopCount) that you defined somewhere, example in your config file
int n = Integer.parseInt(testExec.getStateValue("loopCount"));
String result = "";
for (int i; i < n; )
{
result=result + snippet + "\n";
}
// Store result in property, example "responseBody"
testExec.setStateValue("responseBody", result);
// Avoid that the assertion fires
return true;
------------------------------
Cheers,
Danny
------------------------------
Original Message:
Sent: 07-04-2019 07:42 AM
From: Suvendu Kuila
Subject: Writing groovy script in output log message step
Hi,
I need to form a for loop using groovy in "output log message step" where i can print the string value for n times and store it in a property.
This String Value also consists of some value from property.
E.g:-
<name_detail>
<name>{{property value}}</name>
<email>xyz@gmail.com</email>
</name_detail>
I want to loop the above example dynamically from the "output log message" step and send the response to some rest services
Could anyone please help me with the syntax for this?
Thanks,
Suvendu