Reputation: 149
With the below script I'm able to send the data/payload to my POST request. However, notable to run the post request from the script. Need post request in loop.
def POSTForgivness = testRunner
.testCase
.getTestStepByName("postforgivness")
.getTestRequest()
POSTForgivness.setRequestContent(ForgivnessPayload)
Other info from comments:
Upvotes: 1
Views: 5662
Reputation: 21389
Here you go: sudo code
//Get the next step
def nextStep = context.testCase.getTestStepByName("postforgivness")
//Set the new request
nextStep.httpRequest.requestContent = ForgivnessPayload
//run next step
nextStep.run(testRunner, context)
Just loop thru the above code until you finish the data
Upvotes: 1
Reputation: 1454
Re Need post request in loop.
This sounds like a data-driven test as opposed to a load test.
Place your post-forgiveness request between a 'Data Source' step and a 'Data Source Loop' step.
You can then 'loop' over your post-forgiveness step as many times as there are rows set up in your data source step. For each row you have set up, you can define the payload to 'squirt' into your request.
There is an excellent article on the SoapUI website https://www.soapui.org/data-driven-tests/functional-tests.html.
Upvotes: 0