cancel
Showing results for 
Search instead for 
Did you mean: 

Using a variable in the Request URL

Frequent Contributor

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?

 

 

image.png

3 REPLIES 3
Highlighted
Community Hero

Re: Using a variable in the Request URL

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

 

2endpoints.PNG

 

 

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

 

endpoint selection.PNG

 

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

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the title of the post to something more descriptive? This will help people when searching for problems.
Community Hero

Re: Using a variable in the Request URL

Yes. But there is trivial error

Use ${#Project#address}


Regards,
Rao.
Community Manager

Re: Using a variable in the Request URL

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?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors