Forum Discussion

filpvv's avatar
11 years ago

Can't create groovy script for run REST request. Please help

Hi all,

I have a task to create groovy script which will run REST request and setup property.
I setup property by script:
testRunner.testCase.setPropertyValue( "ScriptProFrom", "BIF" )
testRunner.testCase.setPropertyValue( "ScriptProTo", "STD" )

But I can't find how to run REST request. I tried to do it like this:
myInterface = (RestService) testRunner.testCase.testSuite.project.getInterfaceByName("http://www.webservicex.net")
myOperation = myInterface.getOperationByName("ConversionRate")
myRequest = myOperation.getRequestByName("Request 1")

and get "Script-result: com.eviware.soapui.impl.RestRequest@6a80901" and it cool if it my request, but how to run it?
Please, help...
  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi,

    please, try this:

    myRequest.submit(context, false)


    Since you want to run the request from the Interface level, you need to "submit" it.
    Btw, why aren't you running it as a TestStep in a TestCase? It could be much easier for you than this solution.

    Regards,
    Marek