Forum Discussion

fpanwaskar's avatar
13 years ago

Parameterise endpoint urls

Hi,

We have a project where there is a wsdl/endpoint per operation. We find the soap ui gui to send requests very useful for testing but with multiple environments we have too many choices for endpoints to select from the drop down.

This would be eased if I could parameterise the domain as a property that can then be changed to switch environments.

Is there a way to do this?
  • ajcapri's avatar
    ajcapri
    Occasional Contributor
    One of the forum rule says:

    'Please check that your question has not been answered anywhere else on the site. The search feature is brilliant.'

    I think your question has been answered if you could browse through other topics on similar subject.
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    each request has in test properties property Endpoint. You can add here something like this: ${#Project#Endpoint} and in project properties you can add custom property Endpoint which your value
  • Click on your created soapui project and add your wsdl/endpoint as properties at project level with unique name as I use property name Endpoint
    you pass this property with syntax ${#Project#Endpoint} in your test steps
    • ankushpal's avatar
      ankushpal
      New Contributor

      How can we get this endpoint Url from a Excelsheet rather than setting in the properties at project level.

  • NukerDoggie's avatar
    NukerDoggie
    Occasional Contributor
    I have done exactly as specified here, but I cannot get the Endpoint parameterization to work.

    I created a custom property called url at the project level and gave it a good value of the form https://servername:portno

    Then I edited my test steps Endpoint Property to be ${#Project#url}

    The test step Endpoint property does not expand into the value for url which I have entered at the Project level.

    And when I click on the green arrow to execute the test step, nothing happens - no call is made and no error.

    Interestingly, if I intentionally enter the wrong thing for Endpoint at the test step level, like ${#Project#urls} then SoapUI catches the mistake (the extra "s" on the end of url) and tells me the Endpoint is invalid.

    Why is the expansion not happening?
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    hm and can you test if in this property you have right value ?
    just write groovy script:

    def url = context.expand( '${#Project#url}' )
    assert url == "https://servername:portno"
  • NukerDoggie's avatar
    NukerDoggie
    Occasional Contributor
    When I run the suggested Groovy script I get a failure. So the expansion is not happening correctly. In Groovy can I print the value of what's contained in ${#Project#url) ? That might give a clue as to what is wrong.
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    yes, you can do println yourProperty but result you can see only if you runing soapUi with commandline or your can do log.info "something" and you can see result in Log Output under the groovy script

    If you can share your project I can figure out what are you doing wrong
  • NukerDoggie's avatar
    NukerDoggie
    Occasional Contributor
    Unfortunately I cannot share my project - it is customer-proprietary information. But I'll try the log you suggested. Thanks!