I have a header called RequestID that has a value of a UUID I generated in the groovy script below:
import static java.util.UUID.randomUUID
import com.eviware.soapui.support.types.StringToStringMap
def uuid = randomUUID() as String
def headers = new StringToStringMap()
headers.put("RequestID", uuid)
testRunner.testCase.getTestStepByName("Get Username").testRequest.setRequestHeaders(headers)
I also have a REST request named "Get Username" that is called multiple times via a datasource loop. My groovy script seems to only be generating one UUID for the entirety of the loop and not a new UUID for each hit. Am I missing something in my script or is the order of the steps wrong? I'm also using a grid in my datasource step called SSN to feed data into the request.
Here is the order of my steps in SOAPUI:
- SSN
- Groovy Script
- Get Username,
- DataSource Loop (Datasource step: SSN, Target step: Get Username)
Essentially every time a new request is sent, there should be a new requestid. If that makes sense.