Forum Discussion

kric's avatar
kric
New Contributor
7 years ago

SoapUI 5.4.0 query on setup script :dynamic endpoint url

Hi i want to place the endpoint url dynamically on the basis of test case name through setup script in SOAPUI 5.4.0 version. If I am having three test cases in a test suite ,Testcase-A and Testcase-b...
  • JHunt's avatar
    JHunt
    7 years ago

    Sorry, I misread. You were wanting to set the endpoint on each testStep in a testcase.

     

    Try:

    Map endpoints = [
        'UAT_API': [
            "http://foo",
            "http://bar"
        ],
        'IT2': [
            "http://foo2",
            "http://bar2"
         ],
        //...
    ]
    
    def result = com.eviware.soapui.support.UISupport.prompt("Please select the enviornment", "Environment", ['UAT_API','IT2','IT3','UAT1','UAT2','UAT3'])
    
    def cases = testSuite.getTestCaseList()
    cases[0].getTestStepList().each { step -> step.setPropertyValue("endpoint", endpoints[result][0]) }
    cases[1].getTestStepList().each { step -> step.setPropertyValue("endpoint", endpoints[result][0]) }
    cases[2].getTestStepList().each { step -> step.setPropertyValue("endpoint", endpoints[result][1]) }