Forum Discussion

hutabarat2014's avatar
hutabarat2014
Contributor
10 years ago

Find out Endpoint and adjust some properties

Hi,

I am having this issue.

I got at least 2 different environments, say, ABC environment and DEF environment.

For each environment I got 2 different endpoints, let's say TP_ABC and TP_DEF.

With these 2 endpoints, there are few properties that are specific to different environment.

Let's say I got this IP_Address property specific to ABC and DEF, respectively, they are IP_Address_ABC and AP_Address_DEF.

This issue is sometimes I forgot to change this property MANUALLY.

Because I am using property expansion, I forget to change in the request XML to change from #IP_Address_ABC to #IP_Address_DEF.

Is there a way to know or find out the endpoint and adjust the property accordingly in XML request?

Many thanks,
Leo

3 Replies

  • Hi All,

    I am trying to find out about the endpoint using the User Interface at Test Suite level as follows:

    def UI = com.eviware.soapui.support.UISupport;
    def OPTION = UI.prompt("1: Testing, 2: Staging");

    if ( OPTION == '1' )
    {
    //what in here?
    }
    else ( OPTION == '2' )
    {
    //what in here?
    }


    The issue now is what to insert in the conditional option.

    What I would like to happen, ideally, is that all the test steps that require certain properties based on different environment will be changed accordingly and automatically.

    For example, if the default is ABC environment, then we got:

    Test Step 1
    In Request XML we got:
    <IP>#IP_Address_ABC</IP>

    Test Step 2
    In Request XML we got:
    <IP>#IP_Address_ABC</IP>

    Test Step 3
    In Request XML we got:
    <IP>#IP_Address_ABC</IP>

    When we use the UI above and enter '2' which is Staging environment, we should get the followings:

    Test Step 1
    In Request XML we got:
    <IP>#IP_Address_DEF</IP>

    Test Step 2
    In Request XML we got:
    <IP>#IP_Address_DEF</IP>

    Test Step 3
    In Request XML we got:
    <IP>#IP_Address_DEF</IP>


    without me having to lift any more finger than necessary.

    If that is the case, what would be in the conditional statements above that I need to write?

    Many thanks,
    Leo
  • Hi All,

    Here is what I found so far.

    In Request XML, I put the following:

    <IP>${Groovy Script#result}</IP>



    All I have to do is the Groovy Script that I need to write.

    So far I come up with the following, but nothing is successful:


    def ui = com.eviware.soapui.support.UISupport;
    def option = ui.prompt("1 Testing, 2 Staging","Environment Selection");

    if ( option == '1' )
    {
    def testing1 = "127.0.0.1"
    log.info testRunner.testing1
    }
    else ( option == '2' )
    {
    def testing2 = "127.0.0.2"
    log.info testRunner.testing2
    }
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    A different approach would be to have 4 environments in total, with one endpoint each and where the IP_ADDRESS property would be unique for each environment. Then when you select any environment it will have the properties that you need already ready.

    Regards,

    Giscard
    SmartBear Support