Forum Discussion

Sanika's avatar
Sanika
New Contributor
7 years ago

how to make the req URL variable for http testcase (to carry out the test in different environments)

Hi everyone.. I am new to SOAP UI (using open source) and trying to explore the available options.

I need to create a test step HTTP Request for which I need to provide URL. The URL contains environment name hence I want to set it up as a variable. 

Ex: URL is 

https://api.<environment name>.base.be/ocapi/oauth/userdetails

How do I achieve this?

 

For SOAP and REST requests that I worked on earlier, I could use ${#Project#envName} to make environment name variable in the Endpoint URL, by setting the value as Project level parameter. However I am not able to do the same for Request URL

  • Thank you Lucian for the solution.

    Issue was with the Request Properties where the variable wasn't set correctly.

  • Sanika's avatar
    Sanika
    New Contributor

    Thank you Lucian for the solution.

    Issue was with the Request Properties where the variable wasn't set correctly.

  • Lucian's avatar
    Lucian
    Community Hero

    Hi,

     

    The project property approach that you've used before should work fine. For instance I created a project property called 'environmentHost' and gave it the value 'google.com'. 

     

     

    I then created an http request and referenced the property like:

     

    http://${#Project#environmentHost}/

     

    ...and the property was successfully replaced in the request by its value.

     

    • MGO's avatar
      MGO
      Regular Visitor

      Hi.

      I tried out to define the value as variable (${#API TESTING#individualSearchId}) but this doesn't work. 

      individualSearchId was set with property transfer.

      Am I doing something wrong?

      Or is there annother solution?

  • Sanika's avatar
    Sanika
    New Contributor

    Thanks for the quick response.

    If I do that, this is what is happening. All the capital letters are appearing as small and it's not being recognized.

     

     

    • Lucian's avatar
      Lucian
      Community Hero

      Well the property is only replaced with its value when the request is done. Can you post a sample project?

       

      By the way, are you from Belgium? :smileyvery-happy: