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

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 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).

  • 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.

DigitalZoom Reporting API Terminology

Using the DigitalZoom Reporting API requires that you be acquainted with some information:

  • CQL_NAME - For example https://demo.perfectomobile.com  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 https://demo.perfectomobile.com then the corresponding reporting server would be accessed at: https://demo.reporting.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.

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.

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 a specific driver execution
_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:

  • 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.

Headers

Add the following header parameters to the request:

NameValue
PERFECTO_AUTHORIZATION

<Your personal security token>

For example:

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":"sklghjfwekrghslkdfghsdjgh",
		 "reportURL":"https://...../perfectomobile.com/test/sklghjfwekrghslkdfghsdjgh"
		 "externalId": "9e680d09-ee43-4ba6-ae65-5c18a0debab7",
         "name":"Demo execution #3",
         "owner":"devuser1@company.com",
         "startTime":1475744497630,
         "endTime":1475744500321,
         "uxDuration":2164,
         "status":"PASSED",
         "platforms":[  
            {  
               "deviceId":"#456",
               "deviceType":"MOBILE",
               "os":"ANDROID",
               "osVersion":"4.3",
               "screenResolution":"720x1280",
               "location":"New-York",
               "mobileInfo":{  
                  "manufacturer":"Samsung",
                  "model":"Galaxy S3",
                  "imei":"",
                  "imsi":"",
                  "phoneNumber":"",
                  "distributor":"",
                  "firmware":"",
                  "operator":"",
                  "operatorCountry":"",
                  "email":"",
                  "description":""
               },
               "videos":[  
                  {  
                     "startTime":1475744495734,
                     "endTime":1475744637831,
                     "format":"MP4",
                     "streamingUrl":"https://2b8c1b2b591acbcf1db7568ec8690e536826e763fc.mp4",
                     "downloadUrl":"https://b8c1b2b591acbcf1db7568ec8690e536826e763fc.mp4",
                     "screen":{  
                        "width":950,
                        "height":1267
                     }
                  }
               ]
            }
         ],
         "job":{  
            "name":"MyJobName-2",
            "number":13577
         },
		 "project":{ 
            "name": "DemoProject",
            "version": “10.6”
         },
         "tags":[  
            "Red team",
            "Nightly"
         ],
		 "executionEngine": {
			"version": "10.1"
		 },
         "artifacts": [{
                 "type": "VITALS",
                 "path": "http://.../vitalsFile"
             },
             {
                 "type": "DEVICE_LOGS",
                 "path": "http://.../logFile"
             },
             {
                 "type": "NETWORK",
                 "path": "https://.../netFile"
             }
         ],
		 "reportURL": "https://...reporting.perfectomobile.com/test/58ce700146e0fb0005b87872" 
		}
   ],
   "meta":{  
      "createdAt":"1452419076769",
	  "processingStatus": "PROCESSING_COMPLETE",
	  "apiVersion":"v1",
      "userId":"MyUserID@perfectomobile.com",
      "tenantId":"MyTenantID"
   }
}

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: sklghjfwekrghslkdfghsdjgh

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"
                  }
               ]
            }
         ]
      }
   ],
   "meta":{  
      "createdAt":"1452419076769",
      "apiVersion":"v1",
      "userId":"MyUserID@perfectomobile.com",
      "tenantId":"MyTenantID"
   }
}