Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Nov 01, 2018 10:56

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 - The "private" name of your Perfecto CQ Lab.
    For example: If you use the lab at: https://demo.perfectomobile.com then 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 ".app" appended to the CQL_NAME.
    For example: If you access your Perfecto Lab using the URL https://demo.perfectomobile.com then the corresponding reporting server would be accessed at: https://demo.app.perfectomobile.com
  • 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:
Capabilities capabilities = driver.getCapabilities();
String executionId = (String) capabilities.getCapability("executionId");

Code samples

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.

Note: The security token is associated with the specific Perfecto Lab and the personal registered user.

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.

Important Note: The API calls are only valid after closing the Automation Driver, by executing the driver.close() method.

Retrieve the Execution Driver Report

The following HTTP GET command is used to retrieve a list of the test executions in your lab

MethodAPI
GEThttps://<reporting-server>/export/api/v1/test-executions

Parameters

The following URL query parameters can be added to the URL to filter the number of returned executions.

Important Note:When transmitting URL parameters that include special characters, such as the bracket characters ('[', ']'), the URL should be URL-encoded. We suggest using tools that encode URL parameters, like those included in the Apache HTTP Client component.

NameValueDescription
startExecutionTime[0]<Unix time>The start time, in milliseconds from midnight January 1, 1970 GMT - Epoch/Unix Time
endExecutionTime[0]<Unix time>The end time, in milliseconds from midnight January 1, 1970 - GMT Epoch/Unix Time
externalId[0]<Driver execution id>Filter the data to show reports that match a specific driver execution
tags[0]<Reporting tag>Filter the data to show reports that match a specific tag
jobName[0]<CI Job Name>Filter the data to show reports that match a specific job name
jobNumber[0]<CI Job Number>Filter the data to show reports that match a specific job number
_pageinteger

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.

Headers

Add the following header parameters to the request:

NameValue
PERFECTO_AUTHORIZATION

<Your personal security token>

For example:

Response Format

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.

Note: The processing of many of the components of the final report, e.g. videos and other artifacts, may require additional time. The processingStatus field (in the metadata) indicates when all processing is complete by changing from PROCESSING (some artifacts not available) to PROCESSING_COMPLETE.

{
    "resources": [
        {
            "id": "5ad4888888c00080dd75a",
            "externalId": "888888@devtools.com_RemoteWebDriver_08-08-16_06_66_36",
            "name": "com.example.playground",
            "owner": "instrumentedtest@devtools.com",
            "startTime": 1523858478650,
            "endTime": 1523668484428,
            "uxDuration": 2164,
            "status": "PASSED",
            "platforms": [
                {
                    "deviceId": "#1234DEB31",
                    "deviceType": "MOBILE",
                    "os": "ANDROID",
                    "osVersion": "6.0.1",
                    "screenResolution": "1080*1920",
                    "location": "US-BOS",
                    "mobileInfo": {
                        "manufacturer": "Samsung",
                        "model": "Galaxy S5 SM-G900A",
                        "distributor": "ATT-US",
                        "description": "Central-vod",
                        "firmware": "klteuc-user 6.0.1 MMB88M G888AUCS4DPH4 release-keys",
                        "operator": "TT&T-United States of America"
                    },
                    "selectionCriteria": {
                        "platformName": "Android"
                    },
                    "customFields": []
                }
            ],
            "videos": [
                {
                    "startTime": 1588858467015,
                    "endTime": 152385888894,
                    "format": "MP4",
                    "streamingUrl": "https://perfectomobile.com/vods3/mp4:pm/....9dc312e008354210b9c709df58d20fc338886.mp4",
                    "downloadUrl": "https:/perfectomobile.com/ITMS/c456.....4210b9c709df58d20fc33fae32a05bf82666.mp4",
                    "screen": {
                        "width": 1080,
                        "height": 1920
                    }
                }
            ],
            "tags": [
                "a55582871-c524-4f31-a41f-f5888541a61",
                "7a22587b-ac2a-4956-8328-865469838"
            ],
            "executionEngine": {
                "version": "v1"
            },
            "artifacts": [
                {
                    "type": "DEVICE_LOGS",
                    "path": "https://reporting.perfectomobile.com/....instrumentedtest%40devtools.com_RemoteWebDriveb175311.zip"
                }
            ],
            "reportURL": "https://reporting.perfectomobile.com/test/5ad4888880dd75a"
        },
        {
            "id": "5ad6668005aadef1",
            "externalId": "1_2874520F-B013-B3AAFB1E6B64--60D14568107A16E2C6FB5--@@100.66.239.67@@1848",
            "name": "CHECK",
            "owner": "saes@gmail.com",
            "startTime": 15238557905579,
            "endTime": 1523857445638,
            "uxDuration": 4568,
            "status": "PASSED",
            "job": {
                "name": "Sample Job",
                "number": 45
            },
            "platforms": [
                {
                    "deviceId": "1_2548D-CA0F-420F-B013-B3456E6B64",
                    "deviceType": "DESKTOP",
                    "os": "WINDOWS",
                    "osVersion": "10",
                    "screenResolution": "1024x768",
                    "location": "US East",
                    "browserInfo": {
                        "browserType": "INTERNET_EXPLORER",
                        "browserVersion": "latest (11)"
                    },
                    "selectionCriteria": {
                        "driverVersion": "N/A",
                        "platformVersion": "10",
                        "browserVersion": "11",
                        "browserName": "Internet Explorer",
                        "location": "US East",
                        "seleniumServerVersion": "3.4.0",
                        "platformName": "Windows",
                        "resolution": "1024x768"
                    },
                    "customFields": []
                }
            ],
            "videos": [
                {
                    "startTime": 1523845681,
                    "endTime": 1523845610053,
                    "format": "MP4",
                    "streamingUrl": "https://perfectomobile.com/vods3/_definst_/mp4:pm/....68ff8f616766ad6c9c3348c678cd81.mp4",
                    "downloadUrl": "https://perfectomobile.com/branchtest/samples@gmail.com/......68ff8f616766ad6c9c3348c678cd81.mp4",
                    "screen": {
                        "width": 1024,
                        "height": 768
                    }
                }
            ],
            "tags": [
                "Native",
                "Java",
                "Sample"
            ],
            "executionEngine": {
                "version": "18.4.0.4"
            },
            "artifacts": [],
            "reportURL": "https://reporting.perfectomobile.com/test/4564849684adef1",
            "project": {
                "name": "Sample Script",
                "version": "1.0"
            }
        },
        
    ],
     "metadata": {
        "createdAt": 1523859648413,
        "apiVersion": "v1",
        "userId": "reporting@perfectomobile.com",
        "tenantId": "bperfectomobile-com",
        "processingStatus": "PROCESSING_COMPLETE",
        "page": 1,
        "truncated": false
    }
}

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:

MethodAPI
GEThttps://<reporting-server>/export/api/v1/test-executions/<TEST_ID>/commands

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:

NameValue
PERFECTO_AUTHORIZATION<Your personal security token>
For example:

The following shows a JSON response for the request to retrieve a STR data:

{  
   "resources":[  
      {  
         "testExecutionId":"57f612f1c6c46111b02db94f",
         "commands":[  
            {  
               "name":"Command_vhsc2",
               "status":"SUCCESS",
               "startTime":1475744497372,
               "endTime":1475744498152,
               "uxDuration":551
            },
            {  
               "name":"Command_iofcw",
               "status":"FAILURE",
               "message":"Stacktrace:\n0...",
               "startTime":1475744498157,
               "endTime":1475744499611,
               "uxDuration":0,
               "screenshots":[  
                  "https://...sample-data/jpg.jpeg"
               ],
               "expectedData":[  
                  {  
                     "type":"TEXT",
                     "value":"TEXT_0"
                  }
               ],
               "resultData":[  
                  {  
                     "type":"TEXT",
                     "value":"TEXT_0"
                  }
               ]
            },
            {  
               "name":"Command_hi dsffsdf dsfdsssb",
               "status":"FAILURE",
               "message":"Stacktrace...",
               "startTime":1475744499618,
               "endTime":1475744521762,
               "uxDuration":0,
               "screenshots":[  
                  "https://...sample-data/jpg.jpeg",
                  "https://...sample-data/png.png",
                  "https://...sample-data/png.png",
                  "https://...sample-data/png.png"
               ],
               "expectedData":[  
                  {  
                     "type":"TEXT",
                     "value":"TEXT_0"
                  },
                  {  
                     "type":"IMAGE_KEY",
                     "value":"https://...sample-data/sample64.jpeg"
                  },
                  {  
                     "type":"TEXT",
                     "value":"TEXT_3"
                  }
               ],
               "resultData":[  
                  {  
                     "type":"TEXT",
                     "value":"TEXT_0"
                  },
                  {  
                     "type":"IMAGE_KEY",
                     "value":"https://...sample-data/sample65.jpeg"
                  },
                  {  
                     "type":"TEXT",
                     "value":"TEXT_3"
                  }
               ]
            }
         ]
      }
   ],
   "metadata":{  
      "createdAt":"1452419076769",
      "apiVersion":"v1",
      "userId":"MyUserID@perfectomobile.com",
      "tenantId":"MyTenantID"
   }
}