Forum Discussion
As you have moved to ReadyAPI, could you take advantage of the Reporting features available instead of scripting it
There are a Preconfigured Report Styles, which include Data Export For Automation. This would give you a csv file with the test results for each test case.
https://support.smartbear.com/readyapi/docs/testing/reports/existing/export.html
- bucuali4 years agoOccasional Contributor
Hello MConneely ,
Thanks for replying to the question. I am aware of the functionality but unfortunately it's not an option for my use case. My full requirement is the following: This project runs in Jenkins, and it has to return a .csv report which is sent from the pipeline to another app, at the same time a .pdf version of this report is sent by mail along with the Allure report (both mandatory). Now, the script runs fine, but the .csv and .pdf versions are very long as it shows all the test steps (around 400) and I have to reduce it's size by showing only test case results. Also, the app processing the .csv report has already been modified to expect test case results and process them accordingly, so no turning back at this point..
Any ideas/resources on how to do this?
Thank you in advance for the help 🙂
- MConneely4 years agoStaff
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- bucuali4 years agoOccasional Contributor
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
Related Content
- 7 years ago
- 4 years ago
- 7 years ago
Recent Discussions
- 2 hours ago
- 16 days ago