Please look at Sample Projects for Automation sections for a more concrete end-to-end example. |
Please Generate API Key if you don't have it for your selected project.
The import process is divided into 3 sections.
This API gets all required test automation details from the user and responds with a URL to upload the results.
URL : https://{{Jira base URL}}/rest/qmetry/automation/latest/importresult
Method : POST
REQUEST HEADER :
Authorization
This Automation REST API is protected by the restrictions provided by JIRA. You need to log in to Jira using the Basic Auth header. Follow the below steps to generate basic Auth and pass it to the 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
Request Parameters
Parameter | Type | Required | Description | Default |
---|---|---|---|---|
format | string | Yes | Format of result file to be imported. Supported formats:
| NA |
testCycleToReuse | string | No | Issue Key of the test cycle to be reused | NA |
environment | string | No | Name of the environment on which test cycle has to be executed | No Environment |
build | string | No | Name of the build for test cycle execution | Blank |
isZip | boolean | No (Yes for QAF) | Pass true for ZIP upload or pass false for single file upload | false |
attachFile | boolean | No | Pass true to upload attachments in execution. For more details, Refer to automation help documents. This parameter is supported only for-
| false |
fields | JSON | No | Provide additional fields to be added on a test case or test cycle level. Refer to the following table for more. Note :
| NA |
Supported Fields
Supported Fields | Type | Test Cycle | Test Case | Default | Comment |
---|---|---|---|---|---|
labels | array | Yes | Yes | null | |
components | array | Yes | Yes | null | |
status | string | Yes | Yes | TO DO | |
priority | string | Yes | Yes | Medium | |
fixVersionId | number | Yes | Yes | null | |
sprintId | number | Yes | Yes | null | |
summary | string | Yes | No | Automated Test Cycle | |
description | string | Yes | Yes | null | |
assignee | string | Yes | Yes | Account Key of current User | Valid User Account Key (Refer to Get account key of the user section below) For example - "JIRAUSER11801" |
reporter | string | Yes | Yes | Account Key of current User | Valid User Account Key (Refer to Get account key of the user section below) For example - "JIRAUSER11801" |
estimatedTime | string | No | Yes | null | Pass time in ‘HH:mm’ format |
plannedStartDate | string | Yes | No | null | Pass date in 'dd/MMM/yyyy HH:mm' format |
plannedEndDate | string | Yes | No | null | Pass date in 'dd/MMM/yyyy HH:mm' format |
customFields | array | Yes | Yes | null |
|
Get the account key of a User
Log in to your Jira Server instance.
Browse http://{BASE_URL}/rest/api/2/user/search?username={username}
You will get the userkey in the output.
Sample Request
{ "format": "cucumber", "attachFile": true, "isZip": false, "environment": "Chrome", "build": "4.1.0", "fields": { "testCycle": { "labels": [ "label1", "label2" ], "components": [ "component1" ], "priority": "High", "status": "To Do", "summary": "Test Cycle Summary Automation with custom fields", "description": "Test Cycle Automation Description", "assignee": "JIRAUSER11801", "reporter": "JIRAUSER11600", "plannedStartDate": "20/May/2021 00:00", "plannedEndDate": "30/May/2021 00:00", "customFields": [{ "name": "Check Boxes", "value": "MCB 1,MCB 2" }, { "name": "Date picker", "value": "29/May/2021" }, { "name": "Date time picker", "value": "29/May/2021 14:55" }, { "name": "Multi DropDown", "value": "MDD 2,MDD 1" }, { "name": "Multi line text field", "value": "QMetry Automation Testing using cucumber framework " }, { "name": "Number field", "value": 1234567890 }, { "name":"Cascade Drop down", "value":"User Details", "cascadeValue": "Email" }, { "name": "Single DropDown", "value": "DD2" }, { "name": "Single line Textbox", "value": "QMetry Automation Testing using cucumber framework" }, { "name": "Custom Radio Button", "value": "Test C" }, { "name":"Single User Picker", "value":"JIRAUSER11600" }, { "name":"Multiple user picker field", "value":"JIRAUSER11801,JIRAUSER11800,JIRAUSER11702" }, { "name":"Custom field type Label for Test Cycle", "value":"TestLabel" } ] }, "testCase": { "labels": [ "label1", "label2" ], "components": [ "component1" ], "priority": "High", "status": "To Do", "sprintId": "1000", "fixVersionId": "10000", "description": "Automated generated Test Case", "assignee": "JIRAUSER11702", "reporter": "JIRAUSER11800", "estimatedTime": "10:10", "customFields": [{ "name": "Check Boxes", "value": "MCB 1,MCB 2" }, { "name": "Date Picker", "value": "29/May/2021" }, { "name": "Date Time Picker", "value": "29/May/2021 14:55" }, { "name": "Multi DropDown", "value": "MDD 2,MDD 1" }, { "name": "Multi line text field", "value": "QMetry Automation Testing using cucumber framework " }, { "name": "Number field", "value": 1234567890 }, { "name":"Cascade Drop down", "value":"User Details", "cascadeValue": "Email" }, { "name": "Single DropDown", "value": "DD2" }, { "name": "Single Line Textbox", "value": "QMetry Automation Testing using cucumber framework" }, { "name": "Radio Buttons", "value": "Test C" }, { "name":"Single User Picker", "value":"JIRAUSER11600" }, { "name":"Multiple User Picker", "value":"JIRAUSER11801,JIRAUSER11800,JIRAUSER11702" }, { "name":"Custom Labels for Test Case", "value":"TestLabel" } ] } } } |
Responses
Response | Description | |||
---|---|---|---|---|
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
| |||
| Returned if import fails If unsupported framework is sent in request
If zip file is not sent in QAF framework request
If one or more fields have invalid value
|
This API is used to upload the automation results file and import test results.
URL : {{URL generated from step 1}}
Method : POST
Request Header
multipart/form-data
Request Body - Binary : Your 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).
Note: File Attachment must be passed in form-data.
Responses
Response | Description |
---|---|
STATUS 204 | Returned if the file is uploaded successfully. |
This API is used to check the progress of automation result import.
GET
application/json
apiKey : {generated-api-key}
Responses
Response | Description | |
---|---|---|
STATUS 200 | Returned if parameters are validated successfully. Example
| |
STATUS 400 | Returned in invalid trackingId If trackingId is invalid Example
|