arunbharath
6 years agoContributor
How to get a test-step response from Suite TearDown script?
Hi All. I trying to get step step response of each test case from suite TearDown script.
def testCaseCount = runner.testSuite.getTestCaseCount() for (int i=0;i<testCaseCount;i++){ def testCaseName = runner.testSuite.getTestCaseAt(i).getName() def testStepCount = runner.testSuite.getTestCaseAt(i).getTestStepCount() for (int j=0;j<testStepCount;j++){ def testStepName = runner.testSuite.getTestCaseAt(i).getTestStepAt(j).getName() // log.info(testStepName) if (testStepName == "SendPayment"){ def request=context.expand('${SendPayment#Response}') log.info(request) } //File f = new File(projectProperty+"/TearDownScriptFiles/"+testCase.name+".json") //f.write(response) } log.info(testCaseName) }
Above is my groovy code. I'm iterating all the testcases under suite and test step as well, I'm trying to get the test-step response based on the test step name. Right now I'm able to iterate the test cases and test steps but I could get the test step response..I belive I need to change below one
if (testStepName == "SendPayment"){ def request=context.expand('${SendPayment#Response}') log.info(request) }
Any input is appreciated. Thanks