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.
Name | Description |
---|---|
Basic Auth |
|
Squish Test Center Access token |
|
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
Name | Type | Required | Description |
---|---|---|---|
project | string | true | If no project exist with the provided value then a new project will be created. |
batch | string | Conditional | If no batch exist with the provided value then a new batch will be created. |
reportId | int | Conditional | ID of the report. |
labels | Labels[] | Conditional | Array of labels. |
test | Test | true | Details of the test to create. |
Suite Responses
Name | Type | Description |
---|---|---|
201 - Created | Suite Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
runId | int | true | ID of expected parent test. Parent test must be a Test Suite. |
test | Test | true | Details of the test to create. |
Case Responses
Name | Type | Description |
---|---|---|
201 - Created | Run Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
runId | int | true | ID of expected parent test. Parent test must be a Test Suite or Test Case. |
test | Test | true | Details of the test to create. |
Feature Responses
Name | Type | Description |
---|---|---|
201 - Created | Run Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
runId | int | true | ID of expected parent test. Parent test must be a Feature. |
test | Test | true | Details of the test to create. |
Scenario Responses
Name | Type | Description |
---|---|---|
201 - Created | Run Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
runId | int | true | ID of expected parent test. Parent test must be a Scenario. |
test | Test | true | Details of the test to create. |
Step Responses
Name | Type | Description |
---|---|---|
201 - Created | Run Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
runId | int | true | ID of expected parent test. |
test | Test | true | Details of the test to create. |
Section Responses
Name | Type | Description |
---|---|---|
201 - Created | Run Response | Successful operation. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
type | string | true | Type of event to create. Valid types are: "PASS", "XPASS", "FAIL", "XFAIL", "WARNING", "ERROR", "FATAL", "LOG", "SKIPPED", "ATTACHMENT" |
message | string | false | Message associated to the event. |
detail | string | false | Detail associated to the event. |
trace | Trace[] | false | Stacktrace from test code related to this event. |
location | Location | false | Source location related to this event. |
vp | VP | false | VP associated with the event, only Screenshot VP is supported. |
attachment | string | false | Name of the file to be considered as attachment, from the list of uploaded files with this event. |
screenshot | string | false | Name 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
Name | Type | Required | Description |
---|---|---|---|
attachments[] | Array[] | true | Array of file uploaded. |
eventData | Event[] | true | See above for the definition of an Event object. |
Event Responses
Name | Type | Description |
---|---|---|
204 - Empty Content | Empty. | Successful operation. |
207 - Multi Status | Event[] Response | Check each event response to learn if successful or not. |
400 - Bad Request | Error Response | Invalid input. |
500 - Server Error | Error Response | Server 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
Name | Type | Required | Description |
---|---|---|---|
name | string | true | Name of the test. |
summary | string | false | The summary attached to the test. |
description | string | false | The description attached to the test. |
Label object
Name | Type | Required | Description |
---|---|---|---|
key | string | true | Name of the label. |
value | string | true | Value of the label. |
Trace object
Name | Type | Required | Description |
---|---|---|---|
uri | string | true | Path to the file. |
line | int | true | Line in the file. |
Location object
Name | Type | Required | Description |
---|---|---|---|
uri | string | true | Path to the file. |
line | int | true | Line in the file. |
VP object
Name | Type | Required | Description |
---|---|---|---|
uri | string | true | Path to the VP reference file inside the repository. |
attachment | string | false | Name of the file to be considered as the screenshot verification result, from the list of uploaded files with this event. |
Suite response
Name | Type | Description |
---|---|---|
project | string | Name of the project where the suite was created. |
batch | string | Name of the batch where the suite was created. |
reportId | int | ID of the report where the suite was created. |
runId | int | ID of the created Test Suite. |
Run response
Name | Type | Description |
---|---|---|
runId | int | Id of the created test run. |
Event Response
Name | Type | Description |
---|---|---|
code | int | Error code returned by the server. |
body | string | Empty if successful or error message depending on the error code. |
Error Response
Name | Type | Description |
---|---|---|
code | int | Error code returned by the server. |
message | string | Description 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.