Result Upload API
The Result Upload API can be used to upload any of the supported test result file formats to Test Center. The API can also be used to add labels or attachments to existing reports.
Authorization
All endpoints use one of the following authorization methods described below, using the HTTP Authorization
header.
Name | Description |
---|---|
Basic Auth |
|
Test Center Access token |
|
POST /import - Create report
When uploading tests results to create a report, you also need to provide information about which project and batch the report will be part of.
You can upload multiple result files at once by specifying the result[]
field multiple times. Depending on the type of result you need to specify the correct content-type
as part of the multipart/form-data content. Those content-types are as follow:
- Squish result xml: application/xml or text/xml.
- Squish zipped result folder: application/zip, application/octet-stream or application/x-zip-compressed.
- Squish result javascript file (from HTML report): application/javascript, application/x-javascript or text/javascript.
- Coco result (CSMES/CSEXE): application/octet-stream.
- JUnit, CppUnit and other xUnit formats: application/xml or text/xml.
For more information about the supported results formats, see Supported result formats.
Report Request Body
Content-Type: multipart/form-data
For uploaded files it is important that the Content-Disposition
header contains the filename
parameter.
Name | Type | Required | Repeatable | Description |
---|---|---|---|---|
project or name | string | Conditional | False | If no project exist with the provided value then a new project will be created. If empty, then Test Center will assume the project name is 'default'. |
batch | string | Conditional | False | If no batch exist with the provided value then a new batch will be created. If empty, then Test Center will create a new batch. |
result[] | N/A | True | True | (Path to) result file. |
label[] | string | Conditional | True | Label in the form of Key=Value. Notes: newlines, comma and double quotes are not valid labels characters. |
attachment[] | N/A | Conditional | True | (Path to) attachment file. |
lastModified[] | string | Conditional | True | Only used when uploading Coco tests results. The Epoch timestamp whose index correspond to the index of Coco CSMES file in the result array will be used as start time for the tests imported, instead of the time of upload. |
Report Responses
Name | Type | Description |
---|---|---|
200 - OK | Report Response | Successful operation. Can still contain information about missing resources found during parsing of tests results. |
400 - Bad Request | Error Response | Invalid input. |
503 - Service Unavailable | Error Response | Server is busy, retry later. |
Report Examples
Upload a Squish result xml with two labels |
Upload a Squish zipped result folder, with a Coco result and an attachment |
Upload a Squish result xml with two labels
Sample Request
POST http://testcenter.example.com/upload/import Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="project" My Test Center project ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="batch" My Batch ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="label[]" OS=Windows ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="label[]" Version=1.0 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="result[]"; filename="results.xml" Content-Type: text/xml (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW--
Use ^ instead of \ as endline on Windows. curl --location http://testcenter.example.com/upload/import \ --header Content-Type:multipart/form-data \ --header Authorization:"Basic XXXXXXXXXXXXXXXXXXX" \ --form project="My Test Center project" \ --form batch="My Batch" \ --form label[]="OS=Windows" \ --form label[]="Version=1.0" \ --form result[]=@"/path/to/file/results.xml"
Sample Response
Status code: 200
{ "imports": [ { "batch": "http://testcenter.example.com/testcenter/explore?type=testsuite&project0=My%20Test%20Center%20project&batch0=My%20Batch", "import-id": 1, "url": "http://testcenter.example.com/testcenter/explore?report=1" } ], "results": { "failures": 12, "passes": 24 }, "success": { "errors": "" "info": "12 failure messages (ERROR/FAIL/FATAL/XPASS), 24 pass messages (PASS/WARNING/XFAIL) and 41 new tests defined", "message": "imported" } }
Upload a Squish zipped result folder, with a Coco result and an attachment
Sample Request
POST http://testcenter.example.com/upload/import Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="project" My Test Center project ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="batch" My Batch ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="attachment[]"; filename="README.md" Content-Type: text/plain (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="result[]"; filename="myresult.zip" Content-Type: application/zip (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="result[]"; filename="mytest.csmes" Content-Type: application/octet-stream (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW--
Use ^ instead of \ as endline on Windows. curl --location http://testcenter.example.com/upload/import \ --header Content-Type:multipart/form-data \ --header Authorization:"Basic XXXXXXXXXXXXXXXXXXX" \ --form project="My Test Center project" \ --form batch="My Batch" \ --form attachment[]=@"/path/to/file/README.md" \ --form result[]=@"/path/to/file/results.xml" \ --form result[]=@"/path/to/file/mytest.csmes"
Sample Response
Status code: 200
{ "imports": [ { "batch": "http://testcenter.example.com/testcenter/explore?type=testsuite&project0=My%20Test%20Center%20project&batch0=My%20Batch", "import-id": 1, "url": "http://testcenter.example.com/testcenter/explore?report=1" } ], "results": { "failures": 12, "passes": 24 }, "success": { "errors": "" "info": "12 failure messages (ERROR/FAIL/FATAL/XPASS), 24 pass messages (PASS/WARNING/XFAIL) and 41 new tests defined", "message": "imported" } }
PATCH /import/{id} - Modify report
This endpoint can be used to add XML results, labels and/or attachments to existing reports. The supported XML results are:
- Squish result xml: application/xml or text/xml.
- JUnit, CppUnit and other xUnit formats: application/xml or text/xml.
Patch Request Body
Content-Type: multipart/form-data
For uploaded files it is important that the Content-Disposition
header contains the filename
parameter.
Name | Type | Required | Repeatable | Description |
---|---|---|---|---|
result[] | N/A | True | True | (Path to) result file. |
label[] | string | Conditional | True | Labels of form Key=Value. Notes: newlines, comma and double quotes are not valid labels characters. |
attachment[] | N/A | Conditional | True | (Path to) attachment file. |
Patch Responses
Name | Type | Description |
---|---|---|
200 - OK | Report Response | Successful operation. Can still contain information about missing resources found during parsing of tests results. |
400 - Bad Request | Error Response | Invalid input. |
500 - Internal server error | Error Response | Server is busy, retry later. |
Patch Examples
Add a Squish result to a report
Sample Request
PATCH http://testcenter.example.com/upload/import/1 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="result[]"; filename="results.xml" Content-Type: text/xml (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW--
Use ^ instead of \ as endline on Windows. curl --request PATCH --location http://testcenter.example.com/upload/import/1 \ --header Content-Type:multipart/form-data \ --header Authorization:"Basic XXXXXXXXXXXXXXXXXXX" \ --form result[]=@"/path/to/file/results.xml"
Sample Response
Status code: 200
{ "imports": [ { "batch": "http://testcenter.example.com/testcenter/explore?type=testsuite&project0=My%20Test%20Center%20project&batch0=My%20Batch", "import-id": 1, "url": "http://testcenter.example.com/testcenter/explore?report=1" } ], "results": { "failures": 10, "passes": 20 }, "success": { "errors": "" "info": "10 failure messages (ERROR/FAIL/FATAL/XPASS), 20 pass messages (PASS/WARNING/XFAIL) and 15 new tests defined", "message": "updated" } }
Add an attachment and a label to a report
Sample Request
PATCH http://testcenter.example.com/upload/import/1 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="label[]" OS=Linux ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="attachment[]"; filename="README.md" Content-Type: text/plain (data) ------WebKitFormBoundary7MA4YWxkTrZu0gW--
Use ^ instead of \ as endline on Windows. curl --request PATCH --location http://testcenter.example.com/upload/import/1 \ --header Content-Type:multipart/form-data \ --header Authorization:"Basic XXXXXXXXXXXXXXXXXXX" \ --form label[]="OS=Linux" \ --form attachment[]=@"/path/to/file/README.md"
Sample Response
Status code: 200
{ "imports": [ { "batch": "http://testcenter.example.com/testcenter/explore?type=testsuite&project0=My%20Test%20Center%20project&batch0=My%20Batch", "import-id": 1, "url": "http://testcenter.example.com/testcenter/explore?report=1" } ], "results": { "failures": 0, "passes": 0 }, "success": { "message": "updated" } }
Definitions
Report Response
Name | Type | Description |
---|---|---|
imports.batch | string | URL to batch containing the report. |
import.import-id | int | id of the created/modified report. |
import.url | string | URL to the report. |
results.failures | int | Number of failures added during creation/modification. |
results.passes | int | Number of passes added during creation/modification. |
success.error | string | Information about the error and/or warning that happened during the request. |
success.info | string | Information about the created failure/passes/tests. |
success.message | string | Information about the successfull request ("imported" or "updated"). |
Error Response
The error response contains an object for the error property, the content is described in the table below:
Name | Type | Description |
---|---|---|
code | int | Error code returned by the server. |
message | string | Description of issue encountered during processing of the request. |
© 2024 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.