Forum Discussion

rajs2020's avatar
rajs2020
Frequent Contributor
4 years ago

ReadyAPI - Understanding the result returned by a groovy script?

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...
  • HimanshuTayal's avatar
    4 years ago

    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")