Result Reporting API

The result reporting API can be used to upload test results to Squish Test Center. You can use it to upload results from test tools for which we do not yet support the result format. You can also use it to increase the detail level of your results, as this API allows reporting results on the same level of detail as Squish result reports, including screenshots, attachments, and even screenshot verification points.

Conceptually report creation and creation of test elements happen implicitly. Reports are created by the suites endpoint. If you don't provide an existing report id, or a set of labels that match a previously created report, a new report will be created. For test elements (suites, testcases, features, scenarios, steps, sections) all endpoints report an execution of the specified Test and return a Run, which represents the execution of the test. If the test that is specified is unknown, it implicitly gets created.

Note: When using this API you are reporting results in a certain hierarchical order. First you are reporting the execution of a suite, and then the execution of a testcase within that suite. It is important to note that you can only report test element executions or test events on the last element created on each hierarchy level for a specific report. So once you are reporting the execution of a second testcase within a suite, you can no longer report executions or events for the first testcase.

To help you get started with using the result reporting API a Python example implementation can be found in the testcenter/examples folder.

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 /suites - Create Test Suites

When reporting a test suite execution, you also need to provide information about which project the test suite belongs to. You also need to specify whether you want the test suite execution to be part of a specific report in a specific batch, or if a new report or batch should be created. The following rules apply:

  • If no batch, report id or labels are provided, then a new batch and report will be created.
  • If a batch is given but no report id or labels, then the suite will be added to the first report of the given batch.
  • If a report id is given, then the suite will be added to the report with this id.
  • If both batch and labels are given, Squish Test Center will try to find a report within the given batch that has the exact same set of labels and reuse it. If no matching report can be found a new report is created.

Suite Request Body

Content-Type: application/json

NameTypeRequiredDescription
projectstringtrueIf no project exist with the provided value then a new project will be created.
batchstringConditionalIf no batch exist with the provided value then a new batch will be created.
reportIdintConditionalID of the report.
labelsLabels[]ConditionalArray of labels.
testTesttrueDetails of the test to create.

Suite Responses

NameTypeDescription
201 - CreatedSuite ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Suite Examples

Create a suite with project and name

Sample Request
POST http://testcenter.example.com/upload/suites

{
    "project": "MyProject",
    "test": {
        "name": "MyTest"
    }
}
Sample Response

Status code: 201

{
    "project": "MyProject",
    "batch": "MyBatch",
    "reportId": 25,
    "runId": 12
}

Create a suite with reportId and fully detailed test

Sample Request
POST http://testcenter.example.com/upload/suites

{
    "reportId": 25,
    "test": {
        "name": "MyTest",
        "summary": "MySummary",
        "description": "MyDescription"
    }
}
Sample Response

Status code: 201

{
    "project": "MyProject",
    "batch": "MyBatch",
    "reportId": 25,
    "runId": 12
}

POST /cases - Create Test Cases

You can use this endpoint to report a test case execution.

Case Request Body

Content-Type: application/json

NameTypeRequiredDescription
runIdinttrueID of expected parent test. Parent test must be a Test Suite.
testTesttrueDetails of the test to create.

Case Responses

NameTypeDescription
201 - CreatedRun ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Case Examples

Create a test case with all details

Sample Request
POST http://testcenter.example.com/upload/cases

{
    "runId": 12,
    "test": {
        "name": "My Test Case",
        "summary": "My Test Case Summary",
        "description": "My Test Case Description"
    }
}
Sample Response

Status code: 201

{
    "runId": 13
}

POST /features - Create Features

You can use this endpoint to report a test feature execution.

Feature Request Body

Content-Type: application/json

NameTypeRequiredDescription
runIdinttrueID of expected parent test. Parent test must be a Test Suite or Test Case.
testTesttrueDetails of the test to create.

Feature Responses

NameTypeDescription
201 - CreatedRun ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Feature Examples

Create a feature with all details

Sample Request
POST http://testcenter.example.com/upload/features

{
    "runId": 13,
    "test": {
        "name": "My Feature",
        "summary": "My Feature Summary",
        "description": "My Feature Description"
    }
}
Sample Response

Status code: 201

{
    "runId": 14
}

POST /scenarios - Create Scenarios

You can use this endpoint to report a scenario execution.

Scenario Request Body

Content-Type: application/json

NameTypeRequiredDescription
runIdinttrueID of expected parent test. Parent test must be a Feature.
testTesttrueDetails of the test to create.

Scenario Responses

NameTypeDescription
201 - CreatedRun ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Scenario Examples

Create a scenario with all details

Sample Request
POST http://testcenter.example.com/upload/scenarios

{
    "runId": 14,
    "test": {
        "name": "My Scenario",
        "summary": "My Scenario Summary",
        "description": "My Scenario Description"
    }
}
Sample Response

Status code: 201

{
    "runId": 15
}

POST /steps - Create Step

You can use this endpoint to report a step execution.

Step Request Body

Content-Type: application/json

NameTypeRequiredDescription
runIdinttrueID of expected parent test. Parent test must be a Scenario.
testTesttrueDetails of the test to create.

Step Responses

NameTypeDescription
201 - CreatedRun ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Step Examples

Create a step with all details

Sample Request
POST http://testcenter.example.com/upload/steps

{
    "runId": 16,
    "test": {
        "name": "My Step",
        "summary": "My Step Summary",
        "description": "My Step Description"
    }
}
Sample Response

Status code: 201

{
    "runId": 17
}

POST /sections - Create Section

You can use this endpoint to report a section execution.

Section Request Body

Content-Type: application/json

NameTypeRequiredDescription
runIdinttrueID of expected parent test.
testTesttrueDetails of the test to create.

Section Responses

NameTypeDescription
201 - CreatedRun ResponseSuccessful operation.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Section Examples

Create a section with all details

Sample Request
POST http://testcenter.example.com/upload/sections

{
    "runId": 17,
    "test": {
        "name": "My Section",
        "summary": "My Section Summary",
        "description": "My Section Description"
    }
}
Sample Response

Status code: 201

{
    "runId": 18
}

POST /events - Create Event

The events endpoint can be used to report test events like succeeded or failed verifications, log messages, warnings, or screenshots and other attachments.

Event Request Body

Note: The vp and attachment parameter are mutually exclusive.

Content-Type: application/json

NameTypeRequiredDescription
typestringtrueType of event to create. Valid types are: "PASS", "XPASS", "FAIL", "XFAIL", "WARNING", "ERROR", "FATAL", "LOG", "SKIPPED", "ATTACHMENT"
messagestringfalseMessage associated to the event.
detailstringfalseDetail associated to the event.
traceTrace[]falseStacktrace from test code related to this event.
locationLocationfalseSource location related to this event.
vpVPfalseVP associated with the event, only Screenshot VP is supported.
attachmentstringfalseName of the file to be considered as attachment, from the list of uploaded files with this event.
screenshotstringfalseName of the file to be considered as screenshot, from the list of uploaded files with this event. Has to be of base MIME type image.

Content-Type: multipart/form-data

NameTypeRequiredDescription
attachments[]Array[]trueArray of file uploaded.
eventDataEvent[]trueSee above for the definition of an Event object.

Event Responses

NameTypeDescription
204 - Empty ContentEmpty.Successful operation.
207 - Multi StatusEvent[] ResponseCheck each event response to learn if successful or not.
400 - Bad RequestError ResponseInvalid input.
500 - Server ErrorError ResponseServer error while processing of the request.

Event Examples

Create a simple PASS event

Sample Request
POST http://testcenter.example.com/upload/events

{
    "runId": 18,
    "type": "PASS",
    "message": "My First Pass",
    "detail": "My First Pass Description"
}
Sample Response

Status code: 201

{
}

Create a FAIL event with a screenshot on failure

Sample Request
POST http://testcenter.example.com/upload/events
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="eventData"

[{"runId": 18, "type": "FAIL", "screenshot": "My Image.jpg"}]
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[]"; filename="My Image.jpg"
Content-Type: image/jpeg

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Sample Response

Status code: 207

[
    {
        "code": 201,
        "body": ""
    }
]

Definitions

Test object
NameTypeRequiredDescription
namestringtrueName of the test.
summarystringfalseThe summary attached to the test.
descriptionstringfalseThe description attached to the test.
Label object
NameTypeRequiredDescription
keystringtrueName of the label.
valuestringtrueValue of the label.
Trace object
NameTypeRequiredDescription
uristringtruePath to the file.
lineinttrueLine in the file.
Location object
NameTypeRequiredDescription
uristringtruePath to the file.
lineinttrueLine in the file.
VP object
NameTypeRequiredDescription
uristringtruePath to the VP reference file inside the repository.
attachmentstringfalseName of the file to be considered as the screenshot verification result, from the list of uploaded files with this event.
Suite response
NameTypeDescription
projectstringName of the project where the suite was created.
batchstringName of the batch where the suite was created.
reportIdintID of the report where the suite was created.
runIdintID of the created Test Suite.
Run response
NameTypeDescription
runIdintId of the created test run.
Event Response
NameTypeDescription
codeintError code returned by the server.
bodystringEmpty if successful or error message depending on the error code.
Error Response
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.