The docs say that a groovy script can return a result named as "result". See link - https://support.smartbear.com/readyapi/docs/functional/steps/groovy.html
I have some test steps which run/call a test case which contains a groovy script. I need to access the result of the script inside the custom properties of the test which calls that script. My questions -
1 - How to access the result returned by a groovy script ?
2 - How to return multiple values in the result & access them ?
thanks!
Solved! Go to Solution.
@rajs2020 : By below way you can access the result returned by Groovy Script:
def val = 1
return val;
How you can use:
${GROOVY_TEST_STEP_NAME#result}
M not sure on how to return multiple value, my guess is you can use array for it or else you can use run time context variable
set the context variable property,
context.setProperty("val1",val1)
context.setProperty("val2",val2)
How to fetch it,
log.info context.getProperty("val1")
log.info context.getProperty("val2")
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
@rajs2020 : By below way you can access the result returned by Groovy Script:
def val = 1
return val;
How you can use:
${GROOVY_TEST_STEP_NAME#result}
M not sure on how to return multiple value, my guess is you can use array for it or else you can use run time context variable
set the context variable property,
context.setProperty("val1",val1)
context.setProperty("val2",val2)
How to fetch it,
log.info context.getProperty("val1")
log.info context.getProperty("val2")
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
@HimanshuTayal- what is "run time context variable"?
@rajs2020 : These are the variables which are created at runtime and remains in the memory until your script is running
Refer below article for more information on the same
Soapui-using-context-variables
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Subject | Author | Latest Post |
---|---|---|