Last updated: May 08, 2018 14:10
Use the DigitalZoom Reporting HTTP API to retrieve your entire test execution content in JSON format. Two types of test execution data can be retrieved -
Execution Driver Report - presents a list of all executions performed. This report includes links to the artifacts (can be downloaded via the links to them): video, device logs, PCAP files, vitals.
Single Test Commands Report - presents the test commands of a particular test execution. The test commands are presented according to their execution order and includes the metadata (time and length of execution) for the test execution. This report includes links to all artifacts (can be downloaded via the links to them): video, screenshots, device logs, PCAP files, vitals and PDF reports (Summary PDF, Single Test Report PDF).
DigitalZoom Reporting API Terminology
Using the DigitalZoom Reporting API requires that you be acquainted with some information:
- CQL_NAME - For example the CQL_NAME=demo
- Reporting Server - Perfecto DigitalZoom Reporting information is stored in a repository on the reporting server. The URI of the reporting server is the same as your Perfecto CQ Lab with ".reporting" appended to the Perfecto Lab name. For example: If you access your Perfecto Lab using the URL then the corresponding reporting server would be accessed at:
- Driver Execution ID - Each execution has a unique identifier. To obtain the id for a particular execution use the following code sequence in your automation script:
To see the full Java code sample see the export-api-sample in the Perfecto Git repository. Similar samples in other languages can be found in the Reporting-Samples folder (look for the export-api-sample in each language folder) in the Git repository.
Obtain a Personal Security Token
The API requires the use of the Perfecto Security Token. Follow the procedure detailed in the Security Token documentation, before proceeding.
Use the desired API to export data:
The API provides two options for retrieving Report information:
- Retrieve the Execution Driver Report data
- Retrieve the Single Test Report data.
Retrieve the Execution Driver Report
The following HTTP GET command is used to retrieve a list of the test executions in your lab
The following URL query parameters can be added to the URL to filter the number of returned executions.
|startExecutionTime||<Unix time>||The start time, in milliseconds from midnight January 1, 1970 GMT - Epoch/Unix Time|
|endExecutionTime||<Unix time>||The end time, in milliseconds from midnight January 1, 1970 - GMT Epoch/Unix Time|
|externalId||<Driver execution id>||Filter the data to show reports that match a specific driver execution|
|tags||<Reporting tag>||Filter the data to show reports that match a specific tag|
|jobName||<CI Job Name>||Filter the data to show reports that match a specific job name|
|jobNumber||<CI Job Number>||Filter the data to show reports that match a specific job number|
The page of the report to return. A page is defined to include up-to 500 items (execution/report units of information).
Default value: 1 - the first 500 items are returned.
Notes regarding time units:
- The endExecutionTime parameter is only relevant if the startExecutionTime is included.
- If using the Epoch Converter tool to generate the Unix time - convert the resulting time to milliseconds by multiplying the result by 1000.
- To programmatically convert human readable dates to Unix time use the information provided at the end of the Epoch Converter page under the heading Convert from human readable date to epoch, but do not divide the result by 1000 to maintain the millisecond Unix time value.
Notes regarding other filter parameters:
- Request can combine any number of the filter parameters (externalId, tags, jobName, jobNumber) to achieve the filtered list.
- To check if there are additional pages in the response - the metadata field includes a truncated item with value true when there are additional resource items stored for the Execution Driver Report. Use the _page parameter to access the additional pages. See an example of using the _page parameter in GitHub.
Add the following header parameters to the request:
<Your personal security token>
The Execution Driver Report is returned as a JSON structure with two sections:
- resources - that provide information regarding the different information items included in the report. Each "page" of the report response is limited to 500 information items.
- metadata - provides high-level information regarding the report. Two fields may be important for further processing:
- truncated - indicates whether there are additional resource information items not included in the current page.
- processingStatus - indicates if all resource information items have completed processing at time of report retrieval.
The following is an example response for test executions -
The information for each test is listed as a "resource". In particular:
- The "id" field below identifies the particular test (the TEST_ID) and can be used to retrieve the Single Test Report for the test.
- The "reportURL" field provides the link to the Single Test Report for the test associated with the "id". The format of the URL is: https://<reporting-server>/test/<TEST_ID>
- Includes information on the device "platform" of the test,
- Provides the Jenkins job-name and build-number of the test and the user's project name and version information.
- The "executionEngine" field provides the Perfecto MCM version used for the execution.
- Provides links to the video segments included for the test.
- Provides links to the artifacts generated for this execution:
- VITALS - links to the vitals report generated if script activates the Start Vitals command.
- NETWORK - links to the pcap file generated for tracking network activity.
- DEVICE_LOGS - links to the logs file generated for the execution.
Retrieve the Single Test Report Data
The following HTTP GET command is used to retrieve the list of commands associated with a single test execution:
The <TEST_ID> is taken from the Execution Driver Report, in the "id" field of the resource. In the example response, above, the <TEST_ID> would be: 5ad4888888c00080dd75a
Add the following parameters to the header section of the request:
|PERFECTO_AUTHORIZATION||<Your personal security token>|
The following shows a JSON response for the request to retrieve a STR data: