Last updated: Mar 25, 2021 18:48
This article walks you through automating the process of downloading all crash reports for a number of days as .zip files from the Perfecto Cloud using the REST API. For presentation purposes, we have used a JSON parser.
The code of a Java standalone application that downloads all crash reports as .zip files along with a JSON report is available here.
You can also enhance the process further by utilizing a JSON file, to have all test report details read from the JSON objects and the details sent or utilized to send along with the .zip file of the crash report that has been downloaded.
For more information, see the related articles at the end of this page.
- Download the code sample from here.
- In your Perfecto cloud, navigate to the Test Analysis view and access the Report Library.
Filter the report library as shown in the following image, copy the "failureReason" alphanumeric code (a unique alphanumeric code for your cloud) from the URL, and assign it to the
failureReasonvariable in the ReportExport_CrashFiles.java file. In the case of our example, the alphanumeric code is 5c0e0afa2aa3a8ed5fa6f064, as shown in the following image.Click to view image
- In the same .java file, modify the following values:
- Cloud name: CQL_NAME="demo"
- Security token: PERFECTO_SECURITY_TOKEN="<securityToken>"
To specify for how many days you want to download the crash files, as per your requirements, modify the values indicated in the following image, with status as failed and failureReason as the value you copy-pasted in step 3.
You can use the startExecutionTime and endExecutionTime values to provide EPOC time for specific day(s) ranges, or you can use the days parameter to specify the number of days.Click to view image
Run the code standalone or after integrating it into your framework to download all crash .zip files along with the testExecutionReport.json file to a folder that will be created with the current (today's) date. The .zip files, when extracted, include either a *.crash file (iOS) or a *.txt file (Android), as shown in the following image.Click to view image
- To enhance your code:
- Have a Pojo class implementation by using the TestExecutionReport.json file and deriving java classes.
- Use the Pojo class objects to get more details about your usage.
Apply a filter to the downloaded file, such as a tag or, through the Platform section, device information (see image).Click to view image
In the case of a Quantum test case, the report includes a message field in the project section that you can utilize for more information on each test case at the execution level (see the image below).Click to view image
The following image shows a crash file for Android and iOS.
If you need help with any of these steps, contact Perfecto Support.