Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
3. Supply an "Authorization" header with the 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
Option 2:
To use a personal access token, perform the following steps:
1. Go to User Profile.
2. Click on Personal Access Tokens and click on Create token.
3. Supply an "Authorization" header with the content "Bearer" followed by a generated token.
zip file must contain files of the same format given in the 'format' param.
Request must contain json raw body payload, form-data is not supported.
Request Parameters
Parameter
Type
Required
Description
Default
format
string
Yes
Format of result file to be imported. Supported formats:
CUCUMBER
TESTNG
JUNIT
QAF
HPUFT
SPECFLOW
NA
testCycleToReuse
string
No
Issue Key of the test cycle to be reused.
TestNG:
→ Hierarchy 2: The testCycleToResue will be ignored.
→ Hierarchy 3: If the testCycleToResue is provided, then the suite name in the files will be ignored. All the test case results for all suites and files will be uplaoded in a single cycle similar to Hierarchy 1 (default).
JUnit:
→ Hierarchy 2: The testCycleToResue will be ignored.
→ Hierarchy 3: If the testCycleToResue is provided, then test case results for all suites and files will be uploaded in a single cycle.
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-
QAF
Cucumber
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:
If the cycle is reused, fields of the test cycle will be ignored.
If the Test case version is reused, fields of the test cases will be ignored.
The Test case fields provided via automation will be added to ALL the Test cases getting created via automation.
NA
matchTestSteps
boolean
No
True: Create/Reuse a test case with a summary and test steps that exactly match the automated test case uploaded through the result file. The execution results and other execution details of the test case and steps will be imported from the automation result file.
False:
When the Test Cycle is not been Reused
→ Create/Reuse a test case with a summary or test case key that exactly matches the automated test case uploaded through the result file, and exclude matching of test steps. The execution results of the test case will be imported or calculated based on the test case/step results from the automation result file. The execution result of the test case will be propagated to the test steps in the case of test case reuse/creation. Individual test case steps will not be matched and their execution results/details will not be picked from the result file.
When the Test Cycle is been Reused
→ When the Test Case Key is mapped in the result file and the Test Case Key is found linked to the Test Cycle.
The existing linked test case version, which is part of the Test Cycle will be used. If multiple versions of the same test case key are linked to the test cycle, the one which traced first will be used. The test steps will not be matched to create a new version or link a different version.
→ When the Test Case Key is mapped in the result file and the Test Case Key is not linked to the Test Cycle and the Test Case Key exists in the Test Case Library.
The existing latest version of the test case that matches based on the test case summary will be linked to the existing Test Cycle. If there are multiple test cases with the same summary exist, the one which is traced first will be linked to the existing Test Cycle. The test steps will not be matched to create a new version or link a different version.
In a project where propagation is off, the status of the step will not be mapped/changed.
→ When the Test Case Key is mapped in the result file and the Test Case Key is not found linked to the Test Cycle and the Test Case Key is not found in the Test Case Library, and the Test Case Summary matches with any existing test cases linked to the Test Cycle.
The existing linked Test Case version which is part of the Test Cycle will be used. The test steps will not be matched to create a new version.
→ The Test Case Key is not mentioned in the result file and the Test Case Summary matches any existing test case that is already linked to the Test Cycle.
The existing linked Test Case version which is part of the Test Cycle will be used based on the summary. The test steps will not be matched to create a new version.
→ When the Test Case Key is mapped in the result file and the Test Case Key does not exist in the Test Cycle OR is Not found in Library and the Test Case Summary also does not match any existing Test case in the Test Cycle andTest Case with the same summary isfound in the Test Case Library.
The existing latest version of the test case that matches based on the test case summary will be linked to the existing Test Cycle. If there are multiple test cases with the same summary exist, the one that is traced first will be linked to the existing Test Cycle. The test steps will not be matched to create a new version or link a different version.
→ When the Test Case Key is mapped in the result file and the Test Case Key does not exist in the Test Cycle OR is Not found in the Library and the Test Case Summary also does not match any existing Test case in the Test Cycle OR is not found in the Test Case Library.
A new test case without steps will be created and will be linked to the Test Cycle being reused.
The execution results of the test case will be imported or calculated based on the test case/step results from the automation result file. The execution result of the test case will be propagated to the test steps in the case of test case reuse/creation. Individual test case steps will not be matched and their execution results/details will not be picked from the result file.
In a project where propagation is off, the status of the step will not be mapped or changed.
true
appendTestName
boolean
No
Applicable only for JUnit or TestNG frameworks automation result uploads with Hierarchy 2 or 3.
Accepted Values = false (Default),true
TestNG
False: Create the Test Case Summary as per the Test Method Name in the result file.
True: Append Test Name to Test Method Name while creating the Test Case Summary as “Test Name. Test Method Name”.
JUnit
False: Create the Test Case Summary as per the Test Case Name exists in the result file.
True: Append Test Suite Name to Test Case Name while creating the Test Case Summary as “Test Suite Name. Test Case Name”.
As per Settings
automationHierarchy
number
No
Applicable only for JUnit or TestNG frameworks.
Set Hierarchy for Automation Uploads “Test Cycle - Test Case - Test Step Hierarchy” as 1 (Default), 2 or 3
For TestNG
Value 1: The Test Name is created as Test Case and Test Methods are created as Test Steps in QTM4J.
Value 2: The Test Name is created as Test Cycle and the Test Method Name is created as Test Case. If there are multiple tests in the result file then multiple test cycles will be created based on the test name.
Value 3: The Suite Name is created as Test Cycle and the Test Method Name is created as Test Cases. If there are multiple suites in the result file then multiple test cycles will be created based on the suite name.
For JUnit
Value 1: The Test Suite Name/Class Name is created as a Test Case and the Test Case Names are created as Test Steps in QTM4J.
Value 2: The Test Suite Name is created as Test Cycle and the Test Case Name is created as Test Case. If there are multiple test suites in the result file then multiple test cycles will be created based on the suite name.
Value 3: The Test Cycle name will be auto-generated or manually provided by the user and the Test Case Name is created as Test Case. If there are multiple suites in the result file then only a single cycle will be created.
As per Settings
Note: If the Test Name or Test Suite Name length is more than 255 characters, the name will be truncated.
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
folderPath
string
Yes
Yes
null
fixVersionId
number
Yes
Yes
null
sprintId
number
Yes
Yes
null
summary
string
Yes
No
Automated Test Cycle
description
string
Yes
Yes
null
precondition
string
No
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
This array contains JSON object which has name and value property.
name property represents name of custom field, user can get it from custom fields screen inside configuration menu.
value property represents value of custom field.
For Date type custom field, pass value in 'dd/MMM/yyyy' format.
For DateTime type custom field, pass value in 'dd/MMM/yyyy HH:mm' format.
For Number type custom field, pass any numeric value
For Single option custom field like Radio button, Single Dropdown etc, pass option value as string. Ex. 'high'
For Multi options custom field like Checkbox, Multi Dropdown etc, pass the value as a comma-separated string. Ex. 'high,medium,low'
For Single User picker type custom field, pass Jira Account Key of the user and For Multi-User picker, pass a comma-separated Jira Account Key of users.
For Labels type custom field pass value as comma separated string. Ex. 'tag1,tag2'
For Cascade type custom field, Pass two level of values. "value" node represents Level 1 dropdown option and cascadeValue node represents Level 2 dropdown option. Ex. "value": "option1", "cascadeValue": "option1_A"
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
{
"url": "https://{{jira base url}}/rest/qmetry/automation/latest/importresult/submitFile?trackingId=3d19c19d-935c-4d08-b3de-74a38b5042a0",
"trackingId": "3d19c19d-935c-4d08-b3de-74a38b5042a0"
}
STATUS 400
Returned if import fails
If unsupported framework is sent in request
{
"status":400,
"errorMessage":"Framework ‘xyz’ is not supported.",
"timestamp":"28/May/2019 04:58"
}
If zip file is not sent in QAF framework request
{
"status":400,
"errorMessage":"Zip file format is required for QAF framework.",
"timestamp":"28/May/2019 05:00"
}
If one or more fields have invalid value
{
"status":400,
"errorMessage": "The supplied fields are invalid",
"errors":[
"Provided Component Name(s) xyz not found ",
"Provided Label Name(s) xyz not found"
],
"timestamp":"29/May/2019 12:44"
}
2.2 Upload test result file
This API is used to upload the automation results file and import test results.
URL : {{URL generated from step 1}}
Method : POST
Request Header
Content-Type : multipart/form-data
{generated-api-key}
Basic ZnJlZDpmcmVk
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.
2.3 See Progress
This API is used to check the progress of automation result import.
GET
application/json
apiKey :{generated-api-key}
: Basic ZnJlZDpmcmVk
Responses
Response
Description
STATUS 200
Returned if parameters are validated successfully.
{
"status":404,
"errorMessage":"No import details found for given tracking id '840ba1e3-bf14-4f08-b19c-e5de6447711b'",
"timestamp":"02/Apr/2020 16:19"
}