Forum Discussion

ravienu's avatar
ravienu
Occasional Contributor
4 years ago
Solved

passing result or variable value from Groovy to test step

Dear Team,

I have query below to achieve one of the requirements. I am using ReadyAPI with proper license.

 

I would like to pass Goovy script result as one request body(XML/JSON) parameter for API. I have written a Groovy script and test step under it. But dont know how to specify groovy result as body request parameter.

 

For example:

def today = new Date()
today.format("dd/MM/yyyy")

//Add some random number to Date field and store it in some variable like cutom_date

 

Now  I would like to pass custom_date as request body(XML) parameter for API step under the groovy script  as below

........
........
<app_date>?</app_date>
.......
.......

cutom_date from groovy script should come and sit at ? place above.

 

Can anyone help on this please ?