Forum Discussion
Hi bucuali,
ive provided some options here, hopefully they will assist.
In the Teardown Script tab of each Test Suite, you could have a version of the following
for ( testCaseResult in runner.results )
{
// Get each test cases name from the suite
testCaseName = testCaseResult.getTestCase().name
// Get each test cases result
testCaseStatus = testCaseResult.getStatus()
//log the information
log.info testCaseName + " : " + testCaseStatus
}
If you wanted to move up a level and look at the results at a TestSuite level, you could put something at the Functional Test TearDown Script level
for ( testSuiteResult in runner.results )
{
log.info(testSuiteResult.getTestSuite().getLabel() + " : " + testSuiteResult.getStatus())
}
Some samples on our documentation should assist you
https://support.smartbear.com/readyapi/docs/testing/scripts/samples/index.html
https://support.smartbear.com/readyapi/docs/testing/scripts/samples/log.html
Hello,
This is certainly going in the right direction, but I've hit a wall when trying to loop through each of the results in the test case creating the reports. I'm not sure what the best way to do it is, but something like:
for(testCaseName in testRunner.getResults())
{
def testSuite = testRunner.testCase.testSuite.name;
def testCase = testCaseResult.getTestCase().name
def status = testCaseResult.getStatus()
reportFile.append('"' + testSuite + '",');
reportFile.append('"' + testCase + '",');
reportFile.append('"' + status + '",' + "\n");
}
doesn't work. No errors, but no results either. Any Idea what I'm missing?
Many thanks again for all the help
- MConneely3 years agoStaff
Hi,
are you confident that you are getting the correct information from the test suite/case/result? Even outputting the data using log.info? Are you adding this to the Teardown script?
If so, is the issue now around the reportFile object not getting populated? Is it the reportFile object read-in CSV file?
- bucuali3 years agoOccasional Contributor
Hi,
Actually I think that is where the issue is coming from. By putting the script in the teardown section I'm executing after all the test cases, including the testcase which is actually supposed to receive the info and create the report (located in a different testsuite dedicated to that purpose). Now this report test case is being called from the teardown script of every other individual test case, so the execution timeline logic doesn't work.
I'm including a snapshot of how the testsuites and the testcases are ordered for a better understanding
I'm still experimenting with different ideas, but none seem to work so far
Thanks again for the help 🙂
- bucuali3 years agoOccasional Contributor
Happy New Year!
Any further thoughts on the matter?
Thank you in advance 🙂