How to Import Automation Results via REST API?

Testers can import automation test results into QMetry via Rest API call.

Step 1 : The automation API details can be found at Automation > Automation Agent > API Key. The page will display as below.  



Step 2 : The page will display the following information. 

  1. Rest API URL that would be used. For Cloud customers it should be https://testmanagement.qmetry.com/rest/import/createandscheduletestresults/1
  2. Method "POST".
  3. Header Details

    Parameter

    Value

    Required

    Accept

    application/json

    Yes

    scope

    default (Scope is a combination of Projectid:Releaseid:Cycleid. Default" is the current logged in project and its default release and cycle. 
    Scope can be mentioned as e.g.12:355:533, this id can be fetched using List Project/Releaes/Cycle API.)

    Yes

    apikey

    Copy from the screen. It's an autogenerated key that is specific to a user login.

    Yes

  4. Body Parameters

    Parameter

    Type

    Required

    Description

    file

    multipart/form-data

    Yes

    Your result file to be uploaded. 
    Supported file extensions: .json, .xml and .zip (zip file must contain files of the format given in the 'entityType' param).

    entityType

    string

    Yes

    Format of result file to be imported. Supported formats:TESTNG or CUCUMBER or JUNIT or HPUFT or QAS

    cycleIDstringNoTarget Cycle Id or Cycle Name. Cycle Id can be fetched using List Cycle API and Cycle Name can be obtained from detail view of target Cycle.

    platformID

    string

    No

    Target Platform Id. Platform Id can fetched using List Platform Api.

    testsuiteId

    string

    No

    Target Testsuite ID. Testsuite id can fetched using List Testsuite Api.

    projectIDstringYes (if scope is not default)Target Project ID or project Key or project name. Project id can be fetched using List Poroject API and the Entity Key or name can be obtained from list view of target Project.
    releaseIDstringYes (if scope is not default)Target Release ID or Release name. Release id can be fetched using List Release API from list detail of target Project.

    dropID

    string

    Yes (if scope is not default)

    Target Build ID or Build name. Build id can be fetched using List Build API from list detail of target Project.

Step 3 : Post importing the file via API

          

Parameters passed

Result

If only File format and entityType was passed as part of body

A new auto generated Testsuite will be created with UTC timestamp. "No Platform" would be linked as Platform. Test cases would be auto linked and execution results would be updated. 

If only File format, entityType and platformID was passed as part of body

A new auto generated Testsuite will be created with UTC timestamp. Platform would be linked as per platform id. Test cases would be auto linked and execution results would be updated. 

If only File format, entityType, platformID & testsuiteId was passed as part of body

Test cases would be auto linked and execution results would be updated in the respective Testsuite that was provided.

If only File format, entityType & testsuiteId was passed as part of body

Test cases would be auto linked and execution results would be updated in the respective Testsuite that was provided. No Platform would be linked to the Test suite.


Below steps show how to execute the API using Postman. 

Step 1 : Download Postman application on Google Chrome.

Step 2 : Open and log into the Postman application.

Step 3 : Then click on the NEW button on the application header.

Step 4 : Open the Headers tab in Postman. Add header details as per Step 2. 



Step 5 : Open the Body tab. Choose form-data and pass mandatory/optional values as per Step-2.

Step 6 : Click Send button. You should receive the below success response. 


Step 7 : Results would be updated as explained in Step 3. 


Restrictions: The restriction of  maximum 500 Automation API call per day per instance have been implemented on external API calls for better control of server resources on cloud.