Forum Discussion
Hi,
It will throw errors as it is incomplete, for example the loop is not closed.
It's purely an example excerpt from your original code just to suggest where you might want to try some logging to see if the loop is working as intended.
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,
- ChrisA4 years agoContributor
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)
}
Related Content
- 6 years agopankajmalinda
- 7 years agoKate
- 7 years agomoolickj
- 9 years agomaximojo