Public API Guide

An API is used to integrate Test IT with external autotest systems. The API allows you to link autotests with test cases in Test IT, receive tasks to run autotests, manage autotest runs, and add the r

Description

The API runs on the HTTP protocol and represents a set of methods by which queries are made and responses are returned for each operation. All responses come in the form of JSON structures.

Login

A user can log in if they have a login and secret key. These should be added to the heads of all API queries. Every user can generate a secret key in their profile settings. Headers required for login:

Key

Value

SecretKeyBase64

{secretKeyBase64}

Authorization

PrivateToken {secretKeyBase64}

Primary URL

All links to API queries in the current documentation include the base URL of the Test IT system, e.g. http://demo.testit.software/

Receiving all autotests in the system

To get a list of all autotests registered in the system, send the following query:

GET /api/Public/GetAllAutoTests

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/GetAllAutoTests" -H "accept: application/json"
-H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/GetAllAutoTests" -H "accept: application/json"
-H "SecretKeyBase64: ZndlUXkyNXFCbkJRUmJvUw==" -H "UserName: admin"

Getting runs for a project

To get a list of automated runs for a project, send the following query:

GET /api/Public/GetTestRuns/{projectId}

Where: {projectId} - project ID

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/GetTestRuns/{projectId}" -H "accept:
application/json" -H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/GetTestRuns/3504" -H "accept: application
/json" -H "SecretKeyBase64: ZndlUXkyNXFCbkJRUmJvUw==" -H "UserName: admin"

Putting a run into "In progress" status

To put a run into "In progress" status, send the following query:

POST /api/Public/StartTestRun/{testRunId}

Where: {testRunId} - this is a valid launch UUID

Once the query has been completed successfully, the run will enter "In progress" status.

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/StartTestRun/{ID}" -H "accept: application
/json" -H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/StartTestRun/cd2a79db-00cf-4606-adbe00eb6fd0dc4a" -H "accept: application/json" -H "SecretKeyBase64: admin" -H "UserName:
ZndlUXkyNXFCbkJRUmJvUw=="

Putting a run into "Stopped" status

To put a run into "Stopped" status, send the following query:

POST /api/Public/StopTestRun/{testRunId}

Where: {testRunId} - this is a valid launch UUID

Once the query has been completed successfully, the run will enter "Stopped" status. A result of "Skipped" will be set for all test points for which no results are obtained.

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/StopTestRun/{ID}" -H "accept: application
/json" -H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/StopTestRun/cd2a79db-00cf-4606-adbe00eb6fd0dc4a" -H "accept: application/json" -H "SecretKeyBase64: admin" -H "UserName:
ZndlUXkyNXFCbkJRUmJvUw=="

Putting a run into "Completed" status

To put a run into "Completed" status, send the following query:

POST /api/Public/CompleteTestRun/{testRunId}

Where: {testRunId} is a valid launch UUID

Once the query has been completed successfully, the test run will enter "Completed" status. A result of "Skipped" will be set for all test points for which no results are obtained.

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/CompleteTestRun/{testRunId}" -H "accept:
application/json" -H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/CompleteTestRun/cd2a79db-00cf-4606-adbe00eb6fd0dc4a" -H "accept: application/json" -H "SecretKeyBase64: admin" -H "UserName:
ZndlUXkyNXFCbkJRUmJvUw=="

Adding autotest results

To add the result of an autotest to the system, send the following query:

POST /api/v2/testResults (available in Swagger)

Query body:

{
"testRunId": "string",
"testPlanGlobalId": 0,
"autoTestExternalId": "string",
"configurationGlobalId": 0,
"outcome": "string",
"message": "string",
"stackTrace": "string",
"duration": 0,
"stepResults": [
{
"action": "string",
"duration": 0,
"outcome": "string"
}
]
}

Where:

testRunId is a valid run UUID in which the result is received

testPlanGlobalId is the ID of the test plan

autoTestExternalId is a line identifying the external autotest

configurationGlobalId is the ID of the configuration in which the result is received

outcome is the outcome of the test (acceptable values are Passed, Skipped, Blocked, or Failed)

message is an accompanying message (optional field)

stackTrace is an optional stack trace (*optional field)

duration is a positive integer value characterizing the time taken to complete the test in milliseconds

stepResults is a list of steps that have been completed

stepResults.action is the name of a method/step that was called

stepResults.duration is the time it took for a method/step to be completed

stepResults.outcome is the result of a completed method/step

A test case can have multiple autotests. When setting the results of autotests in the test plan, the final result of a test point is compiled based on the following weights:

Status

Status weight

Passed

1

Skipped

2

Blocked

3

In progress

4

Failed

5

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/SetAutoTestResult" -H "accept: application
/json" -H"SecretKeyBase64: {SecretKeyBase64}" -H "UserName: {UserName}" -H "Content-Type:
application/json-patch+json" -d "{ \"testRunId\": \"{testRunId}\", \"testPlanGlobalId\": 0, \"
autoTestExternalId\": \"{autoTestExternalId}\", \"configurationGlobalId\": 0, \"status\": \"
{Ready/NotReady}\", \"outcome\": \"{Passed/NotPassed/Skipped}\", \"message\": \"string\", \"
stackTrace\": \"string\"}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/v2/testResults" -H "accept: application/json" -H
"Authorization: PrivateToken {SecretKeyBase64}" -H "Content-Type: application/jsonpatch+json" -d "{ \"testRunId\": \"{testRunId}\", \"testPlanGlobalId\": 0, \"
autoTestExternalId\": \"{autoTestExternalId}\", \"configurationGlobalId\":
{configurationGlobalId}, \"outcome\": \"{Passed/Skipped/Blocked/Failed}\", \"message\": \"
{message}\", \"stackTrace\": \"{stackTrace}\", \"duration\": {duration}, \"stepResults\": [ {
\"action\": \"{action_name}\", \"duration\": {duration}, \"outcome\": \"{Passed/Skipped
/Blocked/Failed}\" } ]}"
curl -X POST "http://192.168.88.140/api/v2/testResults" -H "accept: application/json" -H
"Authorization: PrivateToken a3RxVjJtQlV4RFFOamF5Ng==" -H "Content-Type: application/jsonpatch+json" -d "{ \"testRunId\": \"a547fe79-a441-4d3c-a365-fe639b97a677\", \"
testPlanGlobalId\": 16308, \"autoTestExternalId\": \"autotest1\", \"configurationGlobalId\":
16250, \"outcome\": \"Passed\", \"message\": \"Test message\", \"stackTrace\": \"Test
stackTrace\", \"duration\": 15920, \"stepResults\": [ { \"action\": \"step1\", \"duration\":
15920, \"outcome\": \"Passed\" } ]}"

Creating a new test tun

To create a new test run, send the following query:

POST /api/Public/CreateTestRun

This method creates a new test run in the existing test plan.

Once the query is completed successfully, the GUID of the test run is returned and displayed in the test plan with Pending status. StopTestRun

Query body:

{
"projectGlobalId": 0,
"testPlanGlobalId": 0,
"testPoints": [
{
"configurationGlobalId": 0,
"testCaseGlobalId": 0
}
]
}

Where:

projectGlobalId is a positive number indicating the project's global ID

testPlanGlobalId is a positive number indicating the global test plan's global ID

testPoints is an entity describing test verification. It contains the ID of the test case and configuration

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/CreateTestRun" -H "accept: application/json" -
H "SecretKeyBase64: " -H "UserName: " -H "Content-Type: application/json-patch+json" -d "{ \"
projectGlobalId\": 0, \"testPlanGlobalId\": 0, \"testPoints\": [ { \"configurationGlobalId\":
0, \"testCaseGlobalId\": 0 } ]}"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/CreateTestRun" -H "accept: application/json" -
H "SecretKeyBase64: V1U1YVJXOW9hRTkwTVZaSmNXaHNSQT09" -H "UserName: admin" -H "Content-Type:
application/json-patch+json" -d "{ \"projectGlobalId\": 10844, \"testPlanGlobalId\": 10856, \"
testPoints\": [ { \"configurationGlobalId\": 10846, \"testCaseGlobalId\": 10852 }, { \"
configurationGlobalId\": 10846, \"testCaseGlobalId\": 10850 }, { \"configurationGlobalId\":
10846, \"testCaseGlobalId\": 10848 } ]}"

Adding a document to an autotest result

To add a new document to the result of an autotest, send the following query:

POST /api/Public/testresults/{testResultId}/attachments

Where:

{testResultId} is a valid result UUID (this value can be received when setting a result (query POST /API /v2/testResults; available in Swagger)

Once the query has been completed successfully, the file is added to the result of the autotest. The result of the query is the UUID of the new file

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/testresults/{testresultsId}/attachments" -H "accept: application/json" -
H "SecretKeyBase64: {SecretKeyBase64}" -H "Content-Type: multipart/form-data" -F "file=@{file_path};type=image
/png"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/testresults/cb99153d-6b74-49d5-8893-
59ba6ef3a966/attachments" -H "accept: application/json" -H "SecretKeyBase64:
U2VjcmV0S2V5QmFzZTY0" -H "Content-Type: multipart/form-data" -F "file=@file.png;type=image
/png"

To add a document that is already in the system to the result of an autotest, send the following query:

PUT /api/Public/testresults/{testResultId}/attachments?attachmentId={attachmentId}

Where:

{testResultId} is a valid result UUID (this value can be received when setting a result (query POST /API /v2/testResults; available in Swagger)

{attachmentId} is a valid file UUID. This value can be obtained from a POST /api/Public/testresults/{testResultId} /attachments query or from POST /api/Public/attachment

Sample cURL query (in general terms):

curl -X PUT "http://192.168.88.140/api/Public/testresults/{testresultsId}/attachments?attachmentId={attachmentId}" -
H "accept: application/json" -H "SecretKeyBase64:{SecretKeyBase64}"

Sample cURL query:

curl -X PUT "http://192.168.88.140/api/Public/testresults/66521ff2-b71e-4054-82ea-05be526fc75f/attachments?
attachmentId=ec4bff6c-0d33-4be0-95a8-64cf0a58cb73" -H "accept: application/json" -H "SecretKeyBase64:
U2VjcmV0S2V5QmFzZTY0"

Adding a document to the system

POST /api/Public/attachment

Sample cURL query (in general terms):

curl -X POST "http://192.168.88.140/api/Public/attachment" -H "accept: application/json" -H
"SecretKeyBase64: {SecretKeyBase64}" -H "Content-Type: multipart/form-data" -F "file=@
{file_path};type=image/jpeg"

Sample cURL query:

curl -X POST "http://192.168.88.140/api/Public/attachment" -H "accept: application/json" -H
"SecretKeyBase64: U2VjcmV0S2V5QmFzZTY0" -H "Content-Type: multipart/form-data" -F "file=@file.
png;type=image/jpeg"

Use cases:

  1. Login

  2. Generating a secret key

  3. Creating a project

  4. Creating a test case

  5. Creating an autotest

  6. Attaching an auto-test to a test case. Result: the test case is marked as automated

  7. Creating a test plan

  8. Creating a test suite

  9. Adding a configuration to a test suite

  10. Adding an automated test case to a test suite. Result: marked as automated in the "Result 1 test point" section

  11. Creating a test run, i.e. selecting an automated test point and pressing the "Create test run" button

  12. Getting a test run list for the project using GET /api/Public/GetTestRuns/{projectGlobalId}

  13. Launching a test run via POST /api/Public/StartTestRun/{testRunId}

  14. Assigning a result to an autotest via POST /api/v2/testResults

  15. Completing a test run

    1. If all autotest results are set, the test run will enter "Completed" status

    2. To explicitly complte a test run, i.e. put it in "Completed" status, sent POST /api/Public /CompleteTestRun/{testRunId}

    3. To stop a test run, send POST /api/Public/StopTestRun/{testRunId}