Forum Discussion

harmancheema's avatar
harmancheema
Occasional Contributor
6 years ago
Solved

Set endpoint using groovy script which works in Ready API and Soap UI free version

Hello,

 

I have a project which is being run on both Ready API and Soap UI free version. Since, Soap UI free version does not have the "Environment" feature, I need to set it dynamically using groovy script which I'm doing using this:

testRunner.testCase.getTestStepByName("xxx").getTestRequest().setEndpoint("myURL")

However, this is not setting my endpoint in ReadyAPI, and if I remove the environments from ReadyAPI, I get the pop-up saying my endpoint is not set.

 

All my calls in one test case have different URLs. So, I need to do this in a groovy script before every test step.

 

Any suggestions on how I could make this work which would be compatible for both ReadyAPI and SoapUI free version?

  • Hi harmancheema

     

    Try below code: 

     

    testRunner.testCase.getTestStepByName("").setPropertyValue("Endpoint", "test")

    Hope this will solve your problem as it will work in both SoapUI and ReadyAPI

     

    Click "Accept as Solution" if my answer has helped, and remember to give "kudos" :)

     

    Thanks and Regards,

    Himanshu Tayal

     

2 Replies

  • Hi harmancheema

     

    Try below code: 

     

    testRunner.testCase.getTestStepByName("").setPropertyValue("Endpoint", "test")

    Hope this will solve your problem as it will work in both SoapUI and ReadyAPI

     

    Click "Accept as Solution" if my answer has helped, and remember to give "kudos" :)

     

    Thanks and Regards,

    Himanshu Tayal

     

    • harmancheema's avatar
      harmancheema
      Occasional Contributor

      Thank you!! It works perfectly in both ReadyAPI and SoapUI!!