Result Upload API

The Result Upload API can be used to upload any of the supported test result file formats to Squish 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.

NameDescription
Basic Auth
  • Base64 encoding of username:password.
  • Example: 'Authorization: Basic YWRtaW5AcXQuaW86UXRSb2Nrcw=='
Squish Test Center Access token
  • Use of the token value can provide access assuming the user owning it have upload rights.
  • Example: 'Authorization: Token zX4AAEdKAAD3GwAAfnUAAFd8AADybwAAXnUAAFUaAAA'

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.

NameTypeRequiredRepeatableDescription
project or namestringConditionalFalseIf no project exist with the provided value then a new project will be created. If empty, then Squish Test Center will assume the project name is 'default'.
batchstringConditionalFalseIf no batch exist with the provided value then a new batch will be created. If empty, then Squish Test Center will create a new batch.
result[]N/ATrueTrue(Path to) result file.
label[]stringConditionalTrueLabel in the form of Key=Value. Notes: newlines, comma and double quotes are not valid labels characters.
attachment[]N/AConditionalTrue(Path to) attachment file.
lastModified[]stringConditionalTrueOnly 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

NameTypeDescription
200 - OKReport ResponseSuccessful operation. Can still contain information about missing resources found during parsing of tests results.
400 - Bad RequestError ResponseInvalid input.
503 - Service UnavailableError ResponseServer is busy, retry later.

Report Examples

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.

NameTypeRequiredRepeatableDescription
result[]N/ATrueTrue(Path to) result file.
label[]stringConditionalTrueLabels of form Key=Value. Notes: newlines, comma and double quotes are not valid labels characters.
attachment[]N/AConditionalTrue(Path to) attachment file.

Patch Responses

NameTypeDescription
200 - OKReport ResponseSuccessful operation. Can still contain information about missing resources found during parsing of tests results.
400 - Bad RequestError ResponseInvalid input.
500 - Internal server errorError ResponseServer 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
NameTypeDescription
imports.batchstringURL to batch containing the report.
import.import-idintid of the created/modified report.
import.urlstringURL to the report.
results.failuresintNumber of failures added during creation/modification.
results.passesintNumber of passes added during creation/modification.
success.errorstringInformation about the error and/or warning that happened during the request.
success.infostringInformation about the created failure/passes/tests.
success.messagestringInformation 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:

NameTypeDescription
codeintError code returned by the server.
messagestringDescription of issue encountered during processing of the request.

© 2023 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.