Forum Discussion

endorium's avatar
endorium
Frequent Contributor
6 years ago

Using a variable in the Request URL

I am wantign to use a variable in the request URL field of Soapui Pro.

So the URL would look liek the below.

Is this possible? I cant seem to get it to work if it is possible?

 

Next on the latets testcomplete you can pass variables to soapui pro. How could I pass a value from testcomplete to soapui pro and use that in the request url?

 

 

3 Replies

  • richie's avatar
    richie
    Community Hero

    Hi endorium 

     

    If I'm not misunderstanding - yep - doing what you need is straightforward - well the first part of your request is.  I don't know anything about testcomplete - I'll let someone else answer that portion - but for now - the answer to the first part of your query is below (unless I've totally misunderstood)

     

    Just to be clear, if you think about the string as a whole, considering the fields in ReadyAPI! application you have an endpoint (equates to a server/host/ip address etc.) and the resource (a list of folders that makes up your URI) and you don't appear to have any query parameters - at least according to your screenshot.

     

    There's several ways of doing this, but if you have for example 2 different endpoints - e.g. one for Development and one for Test environments, the way I do this is by creating 2 different custom properties on the Project

     

    see the screenshot below - I have created 2 custom properties on the Project which I'm going to use in my tests

     

     

     

    Then I go into the SoapUI tab and build my tests accordingly - so I add in the relevant REST step, point to the relevant step in the 'New Rest Request' window to add in the step.

     

    I then edit the endpoint field, click on 'add endpoint' and add in the value of ${#Project#EnvironmentNameValue} - (where the EnvironmentNameValue is the value specified in the custom property name field) - see below

     

     

    So as you can see I created 2 different endpoints - 1 for the Dev and 1 for the Test environments - and set these as custom properties at the project level.

     

    That's one way of doing it.

     

    One thing - you have a port specified in the example - the port would fall within the 'endpoint' field rather than 'resource' field in ReadyAPI! so you'd need to include the port in the custom property values specified at the project level.

     

    As I said above - I don't know anything about testcomplete - but this answers the first part of your query

     

    Cheers,

     

    richie

  • nmrao's avatar
    nmrao
    Champion Level 3
    Yes. But there is trivial error

    Use ${#Project#address}
    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Rao, Richie, thanks for your help

      endorium, was your question resolved? Could you please mark the helpful post as a solution or share your own solution with us?