Forum Discussion
JHunt
8 years agoCommunity 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")