Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Info
titleWorking Sample

Please look at Sample Projects and Code Snippets sections for a more concrete end-to-end example.

...

Method : POST

REQUEST HEADER :

  • Content-Type : application/json
  • {generated-api-key}
  • Basic ZnJlZDpmcmVk

Authorization

This Automation REST API is protected by the restrictions provided by JIRA. You need to log in Jira using the basic Auth header. Follow below steps to generate basic Auth and pass it to request header :

1. Build a string of the form username:password

2. Encode the string in Base64 format.

3. Pass an "Authorization" header with content "Basic " followed by the encoded string. For example, the string "fred:fred" encodes to "ZnJlZDpmcmVk" in base64, so you would make the request as follows.


 Authorization:  Basic ZnJlZDpmcmVk


Notes

  • zip file must contain files of same format given in the 'format' param.
  • Request must contain json raw body payload, form-data is not supported.

...

ParameterTypeRequiredDescriptionDefault
formatstringYesFormat of result file to be imported. Supported formats:
  1. CUCUMBER 
  2. TESTNG 
  3. JUNIT 
  4. QAF 
  5. HPUFT 
  6. SPECFLOW
NA
testCycleToReusestringNoIssue Key of the test cycle to be reusedNew Test Cycle will be created.
environmentstringNoName of the environment on which test cycle has to be executedNo Environment
buildstringNoName of the build for test case executionBlank
isZipbooleanNo (Yes for QAF)Pass true for ZIP upload or pass false for single file uploadfalse
attachFilebooleanNo

Pass true to upload attachments in execution. For more details, Refer automation help documents.

This parameter is supported only for-

  • QAF
  • Cucumber
false
fieldsJSONNo

Provide additional fields to be added on test case or test cycle level. Refer to following table for more.

Note : If cycle is reused, fields of test cycle will be ignored.

Blank

...

Responses

ResponseDescription

STATUS 200

Returned if results file is uploaded successfully. The import process might take a while and you would be notified (by email or checking the status of the created test run) once the process completed.

Example

Code Block
{
    "url": "https://{{jira base url}}/rest/qmetry/automation/latest/importresult/submitFile?trackingId=3d19c19d-935c-4d08-b3de-74a38b5042a0",
    "message": "Generated Upload URL is valid for one time use and will expire in 5 minutes.",
    "trackingId": "3d19c19d-935c-4d08-b3de-74a38b5042a0"
}

 
STATUS 400

                                  

Returned if import fails

If unsupported framework is sent in request

Code Block
{
  "status":400,
  "errorMessage":"Framework ‘xyz’ is not supported.",
  "timestamp":"02/Apr/2020 04:58"
}


If zip file is not sent in QAF framework request

Code Block
{  
  "status":400,
  "errorMessage":"Zip file format is required for QAF framework.",
  "timestamp":"02/Apr/2020 05:00"
} 


If one or more fields have invalid value

Code Block
{
    "status": 400,
    "errorMessage": "ValidationThe supplied failedfields forare fields.invalid",
    "errors": [
        "Provided Component Name(s) xyz not found  "TestCase Components c1,c2
could not be found.",     "TestCaseProvided Labels l1,l2 could not be found.Label Name(s) xyz not found"
    ],
    "timestamp": "2903/MayMar/20192020 1215:4432"
  }



2.2 Upload test result file 

...

URL :  {{URL generated from step 1}}

Method : POST

Request Header

  • Content-Type : multipart/form-data
  • {generated-api-key}
  • Basic ZnJlZDpmcmVk

Request Body - Result file to be uploaded. Supported file extensions: .json, .xml and .zip (zip file must contain files of the format given in the 'format' param).

...

Responses

ResponseDescription

STATUS 200

Returned if file is uploaded successfully.
STATUS 400

Returned if file upload happens after URL expiration time or if Content-type=multipart/form-data header is not passed

Example

URL Expiry


Code Block
{
    "status": 400,
    "errorMessage": "You cannot upload multiple files with same URL. Please create new upload request.",
    "timestamp": "03/Apr/2020 15:32"
}

STATUS 204

Returned if file format is not valid.

No Content


2.3 Check Progress

...

GET
application/json
apiKey : {generated-api-key}
Basic ZnJlZDpmcmVk

Responses

ResponseDescription

SUCCESS

Returned if parameters are validated successfully.

Example

Code Block
{
    "format": "CUCUMBER",
    "fileName": "1585908845000_5fcfde02-c044-4cee-baaa-48336384ee1b.json",
    "processStatus": "SUCCESS",
    "importStatus": "SUCCESS",
    "startTime": "03/Apr/2020 15:44",
    "endTime": "03/Apr/2020 15:44",
    "fileSize": null,
    "trackingId": "5fcfde02-c044-4cee-baaa-48336384ee1b",
    "files": null,
    "detailedMessage": "File is imported successfully.",
    "extraAttributes": {
        "attachFile": false
    },
    "summary": {
        "testCycle": "9nw44F4lfp",
        "testCasesCreated": null,
        "testCaseVersionsCreated": null,
        "testCaseVersionsReused": 3,
        "testStepsCreated": 0,
        "testCycleIssueKey": "AP-TR-5"
    }
}


FAILED

Returned if any validation fails

Example


Code Block
{
    "format": "CUCUMBER",
    "fileName": "1585909023000_dc038259-434f-4748-aaa6-a453a05d5ca1.json",
    "processStatus": "VALIDATION/PARSING/CREATING_ASSETS/SUCCESS",
    "importStatus": "SUCCESS/INPROCESS/FAILED",
    "startTime": "03/Apr/2020 15:47",
    "endTime": "03/Apr/2020 15:47",
    "fileSize": null,
    "trackingId": "dc038259-434f-4748-aaa6-a453a05d5ca1",
    "files": null,
    "detailedMessage": "The supplied file is either empty or invalid.",
    "extraAttributes": {
        "attachFile": false
    },
    "summary": {
        "testCycle": null,
        "testCasesCreated": null,
        "testCaseVersionsCreated": null,
        "testCaseVersionsReused": null,
        "testStepsCreated": null,
        "testCycleIssueKey": null
    }
}

...