Import Results - Automated upload using REST API

AIO Tests supports importing of the automation test execution reports through the Import Results API. This article covers the options available while importing results.

After mapping automated tests to AIO tests and executing the test suite, the results file is generated.
This results file can then be imported by passing the file as part of a multipart/form-data request.

Try it out:
https://tcms.aiojiraapps.com/aio-tcms/aiotcms-static/api-docs/

In this documentation, you’ll understand:

API Details:

TestNG

curl -X POST "https://tcms.aiojiraapps.com/aio-tcms/api/v1/project/AT/testcycle/AT-CY-Adhoc/import/results?type=Testng" -H "accept: application/json;charset=utf-8" -H "Content-Type: multipart/form-data" -F "createNewRun=true" -F "addCaseToCycle=true" -F "createCase=true" -F "file=@testng-results.xml;type=text/xml"

JUnit

curl -X POST "https://tcms.aiojiraapps.com/aio-tcms/api/v1/project/AT/testcycle/AT-CY-Adhoc/import/results?type=Junit" -H "accept: application/json;charset=utf-8" -H "Content-Type: multipart/form-data" -F "createNewRun=true" -F "addCaseToCycle=true" -F "createCase=true" -F "file=@TEST-featureTest.xml;type=text/xml"

The API assumes the cycle to be pre-existing, it can either be created from the AIO Tests interface or by using the Create Cycle API.

Explanation of Parameters :

Form Data parameters

Description

Default

Form Data parameters

Description

Default

file

File [results.xml]

Mandatory

createNewRun

Helps control the creation of new runs for repeating tests in a suite execution. Repeating tests may be due to data driven cases or multiple invocation cases.
One may choose to disable it for e.g. in retry cases, where only the last status matters and in between runs don’t matter

true

addCaseToCycle

If mapped case is not already existing in the cycle being executed, adds the case to the cycle and reports results for the case.
If set to false, such cases are reported as errors in case of TestNG

AIO Tests only considers mappings which start with “JiraProjName-TC”- and not all groups

true

createCase

For cases where no key or automation key is found in AIO Tests, if createCase is set to true, a new case is created and added to cycle.
If set to false, such a case is reported as an error

 

updateDatasets

Only impacts tests based on datasets. If set to true, it adds/removes datasets from data driven tests. Can be set to false in retries where subset of datasets only may have been executed.

 

forceUpdateCase

Only applies to Robot cases that include steps. Set to false to prevent steps from being updated from results file. Helpful if users dont want to update the steps from the file.

false

defaultFolder

Assist users in configuring the folder ID to designate the default folder for cases generated via import.

 

Explanation of Response :

Sample Response

{ "status": "SUCCESS_WITH_ERROR", "requestCount": 4, "successCount": 3, "errorCount": 1, "errors": { "SCRUM-TC-2092": { "message": "Case does not exist in cycle. Set addCaseToCycle if you wish to add.", "cause": null, "info": "Consider setting form data addCaseToCycle=true to add case to cycle." } }, "processedData": { "SCRUM-TC-2090": { "tcKey": "SCRUM-TC-2090", "className": "com.aio.tests.tng.SkippedTests2", "name": "failedTest", "status": "Failed", "duration": 0, "finishedAt": 1595440959000, "runId": 2374 }, "SCRUM-TC-2093": { "tcKey": "SCRUM-TC-2093", "className": "com.aio.tests.tng.SkippedTests2", "name": "method1", "status": "Passed", "duration": 0, "finishedAt": 1595440959000, "runId": 2375 }, "SCRUM-TC-2091": { "tcKey": "SCRUM-TC-2091", "className": "com.aio.tests.tng.SkippedTests2", "name": "skippedTest", "status": "Not Run", "duration": 0, "finishedAt": 1595440959000, "runId": 2376 } } }

 

Known Errors List (as part of errors.msg above):

  1. Invalid xml: Unable to parse file. Please check if it is a valid results.xml file.

  2. <Case key> is in Under Review/Draft status. Only published cases can be added to cycle.

  3. <Case key> not found or you don't have privileges to add this case.

  4. Case does not exist in the cycle. Set addCaseToCycle if you wish to add.

  5. No case found with this automation key. Either map automation key or set createCase to true.

  6. Unable to update automation data in the case. Insufficient permissions to edit cases in the project.

Response Errors

For further queries and suggestions, please feel free to reach out to our customer support service via help@aiotests.com.