Forum Discussion

Holly_Greger's avatar
Holly_Greger
Contributor
13 years ago

[Resolved] WSDL interface "Assign" functionality in groovy?

Hello,

I currently have a groovy script that deletes and populates the endpoint list for a given interface of a project based on an external file. The problem I'm having is that when i delete all endpoints and i add a fresh list then all tests steps in that project get a "- no endpoint set -" as the current endpoint for that testStep. I see that the answer to this problem is to go to the interface then select an endpoint then click "Assign" and choose "- All Test Requests -". I was wondering as to how i can accomplish this programmatically in groovy so that this process is not a manual one.

Thank you,

Enzo

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    You can programatically set the endpoint of a request by running request.endpoint = "<new endpoint>". You will need to do this for each endpoint, so you'll want to write something like this:


    import com.eviware.soapui.impl.support.http.HttpRequestTestStep

    def endpoint = "<your endpoint here>"

    project.testSuiteList.each { testSuite ->
    testSuite.testCaseList.each { testCase ->
    testCase.testStepList.findAll( { it instanceof HttpRequestTestStep } ).each { testStep ->
    testStep.httpRequest.endpoint = endpoint
    }
    }
    }


    Regards,
    Dain
    SmartBear Stockholm
  • Hi Dain,

    I actually wrote almost the exact same code you just gave me as the solution but i was hoping the assign functionality would be a method call. I guess is not. Thank you
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Holly Greger wrote:
    Hi Dain,

    I actually wrote almost the exact same code you just gave me as the solution but i was hoping the assign functionality would be a method call. I guess is not. Thank you

    No, it's not. Although you can always create your own methods/libraries that will be available in your soapUI Groovy/Javascript Scripts.

    Henrik
    SmartBear Stockholm