Forum Discussion
4 Replies
Sort By
- JHuntCommunity Hero
Here's a few things you can try:
import com.eviware.soapui.impl.rest.RestMethod import com.eviware.soapui.impl.rest.RestRequestInterface.HttpMethod import com.eviware.soapui.impl.rest.RestResource import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep RestTestRequestStep step = testRunner.testCase.getTestStepByName("Some RestTestRequestStep") step.testRequest.setEndpoint("http://www.example.com/") // change to another existing Resource/Method in your project RestMethod anotherMethod = testRunner.testCase.project.interfaces["Swagger Petstore"].resources["/pet"].getRestMethodByName("addPet") step.setRestMethod(anotherMethod) // you can update the method used by the step, but be aware that it will affect all requests and test requests using that method RestMethod method = step.testRequest.restMethod method.setMethod(HttpMethod.GET) // you can update the resource used by the step, but be aware that it will affect all requests and test requests using that resource RestResource resource = method.resource resource.setPath("/login")
- avidCoderSuper Contributor
Hey,
You could set the properties like this:-
def request = context.expand(${Rest Request#Request})
testRunner.testCase.testSteps["Properties"].setPropertyValue("Rest Request", request)
So, Using this code you are setting the Rest Request to Properties.
Hope this helps you out.
- nmraoChampion Level 3Would you please elaborate the issue, possibly with help of screen shot
- VenkatrajNew Contributor
Thanks for your reply. I want the hilighted rest request properties in the screenshot to be set through groovy script. like (Resource,Method,Endpoint etc.)
ough groovy script
Related Content
- 12 years ago
Recent Discussions
- 11 days ago