How to fetch rest get method request parameters using groovy script
Hi,
Please tell me the way to fetch rest get method request parameters value using groovy script.
Also is it possible that we can get add parameters using groovy.
Kindly let me know.
Using below code i am able to get the endpoint, resource but need help in getting the parameters(query string)
import com.eviware.soapui.impl.rest.RestResource
try
{
def pro=testRunner.testCase.testSuite.project
def tcrest=testRunner.testCase.testSuite.project.getTestSuiteByName("Business Templates").getTestCaseByName("Rest_GetTemplates")
def request =tcrest.getTestStepByName("RequestTemplate_GetPromotions").httpRequest.requestContent
def tcexe=testRunner.testCase.testSuite.project.getTestSuiteByName("Execution Suite").getTestCaseByName("Execution Driver")
def endpoint=tcrest.getTestStepByName("RequestTemplate_GetPromotions").getPropertyValue("EndPoint")
String resourcepath=tcrest.getTestStepByName("RequestTemplate_GetPromotions").getResourcePath()
log.info endpoint
tcexe.getTestStepByName("REST Request Get").setPropertyValue("EndPoint", endpoint)
//String resourcepath= tcrest.getTestStepByName("RequestTemplate_GetPromotions").httpRequest.getPath()
log.info "Business template resource path is"+resourcepath
tcexe.setPropertyValue("ResourcePath", resourcepath)
}
catch(Exception e)
{
log.error " exception message is "+e.getMessage()
}
Thanks,
Himanshu