Forum Discussion
You should use the SubmitListener.beforeSubmit event handler instead.
log.info submit.request.getPath()
submit.request.setPath("/product/api/v4.0/foo")
log.info submit.request.getPath()
Regards,
Marcus
SmartBear Support
- venkateshAousul8 years agoNew Contributor
Hi Marcus,
our project had a requirement, where we need to create the testsuite and test cases using groovy script.
In that case we have created 2 interfaces one for the old API and other for the new API. each test case contains the first API and second api rest steps and followed by a groovy script to compare.
Now the problem is we need set the resource path dynamically by reading it from excel.When I try with the below code which has been suggested by you, then following error message has been thrown: "ERROR:groovy.lang.MissingPropertyException: No such property: submit for class".
Please help me in setting the resource path and query parameters dynamically. Do I need to place any jars ??
Code for reference:
RestRequestStepFactory rest = new RestRequestStepFactory()
def restServiceConfig = RestServiceConfig.Factory.newInstance()restServiceConfig.setType("restrequest")
RestService restService = project.getInterfaceList()[0]RestResource resource = restService.getOperationAt( 0 );
RestRequest request = resource.getRequestAt( 0 );
submit.request.setPath(uri1)
TestStepConfig testStepConfig = RestRequestStepFactory.createConfig(request, d[3] );
def teststep = tc.addTestStep(testStepConfig)
teststep.setDisabled(true)Note Here d[3] is the cell value which reads from the excel sheet, similarly uri1 is assigned by the cell value d[0]
Regards,
Venkatesh
Related Content
- 3 years ago
- 3 years ago
- 5 years ago
- 13 years ago
Recent Discussions
- 7 days ago