Contributions
Re: how to use a variable from a groovy script in the resource patch
HimanshuTayalHi, thank you so much for all your help. It is greatly appreciated. It looks like the problem is the last line of the groovy script. I can run the groovy script separately and it generates a uuid. However, it has a problem when it gets to the last line of the script. I followed exactly what you had recommended to put in the groovy script but I'm still getting the error. An error appears saying: java.lang.NullPointerException: Cannot invoke method setPropertyValue() on null object error at line: 7 // Generating a random variable value. def uuid = UUID.randomUUID() // Logging the variable. log.info uuid testRunner.testCase.getTestStepByName("Propertes").setPropertyValue("uuid",uuid.toString())4 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.7KViews0likes4CommentsRe: how to use a variable from a groovy script in the resource patch
HimanshuTayalThanks again for your help. Much appreciated. This is what my resource path looks like now based on what you explained. I need the uuid in that part of my resource path /source-data/api/feeds/participants/context.expand('${Properties#uuid}')/complete However, I am getting an error when it tries to run the added line in the Groovy script java.lang.NullPointerException: Cannot invoke method setPropertyValue() on null object error at line: 74 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.7KViews0likes1CommentRe: how to use a variable from a groovy script in the resource patch
HimanshuTayalHi Himanshu, thank you for your reply. Sorry but I'm really new to Ready API so Iwas hoping you can confirm if I am doing this correctly. I provided screenshoots of my testcase. Can you tell me what I am doing wrong? I am trying to follow your first recommendation. Gary4 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.8KViews0likes3Commentshow 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 SoI 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, GarySolved4 years agoPlace ReadyAPI QuestionsReadyAPI Questions5.2KViews0likes11Comments