Ask a Question

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

SOLVED
harmancheema
Occasional Contributor

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?

1 ACCEPTED SOLUTION

Accepted Solutions
HimanshuTayal
Community Hero

Re: Set endpoint using groovy script which works in Ready API and Soap UI 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

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

2 REPLIES 2
HimanshuTayal
Community Hero

Re: Set endpoint using groovy script which works in Ready API and Soap UI 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

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

harmancheema
Occasional Contributor

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

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

cancel
Showing results for 
Search instead for 
Did you mean: