Issue in invoking rest method from another test suite using groovy script
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Issue in invoking rest method from another test suite using groovy script
HI All,
I am facing issue where i am unable to invoke rest step that exists in another test suite. When I ran the script, i am always getting "End point url not found". But when I execute the same step directly by clicking Run button it is working fine.
Here is the code that i used to invoke rest method from another test suite in same project.
ServiceName=context.testCase.testSuite.getPropertyValue("Service")
methodname=context.testCase.testSuite.getPropertyValue("Method")
context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].testSteps[methodname].run(null,context)
I double checked the values printed in the log and it looks good. Not sure what's wrong with the above step.
Please find the attached screenshots which might help in understanding the issue. Any help is greatly appreciated.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please try :
..run(testRunner, context)
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks RAO for the response . I have tried this earlier and now also and got the same result.Let me share more details that might help in providing suggestions to this issue.
When I invoke the rest method through groovy script, it looks like it is not passing parameter values.
request: GET /DataVisionService/dh/login// HTTP/1.1
DEBUG:Receiving response: HTTP/1.1 404 Not Found
But when i execute the same request by clicking run button, it is successfully passing parameters and executing the request correctly.
DEBUG:Sending request: GET /DataVisionService/dh/login/userid/password HTTP/1.1
DEBUG:Receiving response: HTTP/1.1 200 OK
Please find the attached screenshot of parameter substitution.
Thanks,
Ravindra
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am creating and setting properties values in the test case during run time..I checked and those properties are set correctly. Manually I have refereed those values in rest method as ${#TestCase#userid} .Please let me know if you need any more information. Thanks once again for looking into the issue.
myTestCase.setPropertyValue(inputtagList,inputValueList)
def x = myTestCase.getPropertyValue(inputtagList)
log.info " x: $x"
Thanks,
Ravindra
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible for you to use "Run Test Case" step instead? Just to see if that is working?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure how to do that one. Let me research on the syntax and get back to you. Incase if you have syntax handy, please share. Appreciate your support.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After I followed the suggestion provided by another user i the forum , it worked like charm. Thank you Rao.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def testCase = testRunner.testCase;
def testStep = testCase.getTestStepAt(0);
//def testStep = testCase.getTestStepByName("Delay");
//def testStep = testCase.testSteps["Delay"];
testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
testStep.run(testRunner, testStepContext);
