how to use a variable from a groovy script in the resource patch
Hi,
I found a knowledgebase article that explained how I can use a groovy script step in a testcase to generate a random uuid:
// Generating a random variable value.
def uuid = UUID.randomUUID()
// Logging the variable.
log.info uuid
So I did that and when I run that particular script in my test case, I see a UUID is being generated properly.
What I would like is to be able to use this output which is stored in a variable called uuid in my next step which is a REST request. I need to pass the value of the variable in my resource path. How can that be done?
Thanks,
Gary
garymags :
Name in bold should be same as the name of your properties test step:
testRunner.testCase.getTestStepByName("Propertes").setPropertyValue("uuid",uuid.toString())
correct it and you are good to go 🙂