Forum Discussion
Hi Chris,
I closed the loop but still i am getting some other errors which i am not aware of them. We are trying to find is there a way to save request and response in REST API services on test suite level. I am in novice in groovy script.
Thanks,
Hi,
Your groovy script is looking pretty good, keep going.
Would you like to post what you have currently? It would be nice if you could tell us what the errors are and where in your code they occur.
- Sirisha20204 years agoContributor
Hi chris,
I am getting the below error when i am trying to run the below code in soapUI log ;
Fri Oct 23 10:03:55 EDT 2020:ERROR:An error occurred [No such property: testSuite for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner], see error log for details
Code:
def testCaseCount = testRunner.testSuite.getTestCaseCount()
for (int i=0;i<testCaseCount;i++){def testCaseName = testRunner.testSuite.getTestCaseAt(i).getName()
def testStepCount = testRunner.testSuite.getTestCaseAt(i).getTestStepCount()
for (int j=0;j<testStepCount;j++){
def testStepName = testRunner.testSuite.getTestCaseAt(i).getTestStepAt(j).getName()
log.info(testStepName)def request=context.expand('${testStepName#Request}')
log.info(request)
}
log.info(testCaseName)
}- PrathapR4 years agoFrequent Contributor
We have to navigate testep to testcase, testcase to testsuite then project. updated below code, please try and let us know,
Code:
def testCaseCount = testRunner.testCase.testSuite.getTestCaseCount()
for (int i=0;i<testCaseCount;i++){def testCaseName = testRunner.testCase.testSuite.getTestCaseAt(i).getName()
def testStepCount = testRunner.testCase.testSuite.getTestCaseAt(i).getTestStepCount()
for (int j=0;j<testStepCount;j++){
def testStepName = testRunner.testCase.testSuite.getTestCaseAt(i).getTestStepAt(j).getName()
log.info(testStepName)def request=context.expand('${V6GetPackageAttributeList#Request}')
log.info(request)
}log.info(testCaseName)
}- Sirisha20204 years agoContributor
Hi Redde,
Thanks for your reply. I gave try with the below code. I created a new test case at last and added a test step as a groovy script. During the execution using the test suite editor, groovy script also executed. But it is not retrieving all the test case details. It is leaving around 4 to 5 and displaying test step name, test case name. We are not getting request and response.
- Fri Oct 23 12:36:25 EDT 2020:INFO:Test Step1
- Fri Oct 23 12:36:25 EDT 2020:INFO: --NO Request
- Fri Oct 23 12:36:25 EDT 2020:INFO: --NO Response
- Fri Oct 23 12:36:25 EDT 2020:INFO:TestStep2
- I have modified the code to display response also.
- def res=context.expand('${V6GetPackageAttributeList#Response}')
- log.info(res)
- But it is not displaying the request as well as response.
Thanks.
Related Content
- 6 years agopankajmalinda
Recent Discussions
- 54 minutes agodipsthorat
- 4 hours agoisbiat
- 2 days agoarmygrad