Test Sessions API (a.k.a TIA API)
You can integrate any Testing framework with Sealights to capture Tests Events like Start and End of Test Stage, Tests results, etc using the API described on this page.
This API includes getting the list of tests recommended to be skipped by Sealights for Test Optimization (TIA) and forcing a Full-Run on the next execution of a Test Stage.
For your reference, you’ll find a few sample integrations with various Testing frameworks listed on our dedicated documentation page.
This API requires an Agent Token.
Creating Test Session
Create a test session with a specific Labid and test stage, if there is no labId - use BSId instead
Calling this request to create a new test session for the current run
POST /sl-api/v1/test-sessions
Request details
Request body
Parameter | Description | Default value | Is mandatory? |
---|---|---|---|
| Lab Id |
|
|
| Test Stage |
|
|
| Build Session Id |
|
|
| Session Timeout (seconds), max timeout 86400 (24 hours) | 14,400 (4 hours) |
|
| Test group id |
|
|
Request Samples
POST /sl-api/v1/test-sessions HTTP/1.1
Authorization: Bearer {sealights-agent-token}
Content-Type: application/json
{
"labId": "LabId",
"testStage": "Unit Tests",
"bsid": "bsId",
"sessionTimeout": 10000,
"testGroupId": "job name"
}
HTTP/1.1 200 OK
HTTP/1.1 404 NOT_FOUND
HTTP/1.1 500 BAD_REQUEST
Response Sample
{
"data": {
"testSessionId": "341dc795-71a8-4253-b686-27ff09f04468"
}
}
Sample Shell command and response:
Linux | |
---|---|
Powershell |
Get Exclude Tests v1 (deprecated)
Getting a list of tests that should be excluded
Test Optimization must be turned on for the Test Stage in order to receive a non-empty response.
Calling this request to get a list of test names that should be excluded in the current run (by default with test names)
You can specify to get only the External Tests IDs (instead of Test Names) to be returned in the response
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| Test Session ID |
|
| enum:
|
|
Request/Response Samples
Sample | Request | Response |
---|---|---|
Default (using test names) | ||
|
|
Sample Shell command and response:
Get Exclude Tests v2
Getting a list of tests that should be excluded
Test Optimization must be turned on for the Test Stage in order to receive a non-empty response.
Calling this request to get a list of test names that should be excluded in the current run (by default with test names)
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| Test Session ID |
|
Request/Response Samples
Sample | Request | Response |
---|---|---|
Default (using test names) |
Sample Shell command and response:
Sending Test Events
Sending test events with status
Calling this request for reporting SeaLights test event result.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| Test Session ID |
|
Request Body
Parameter | Description | Is mandatory? |
---|---|---|
| Array of Test run events (even for a single test) |
|
Test run event |
|
|
| Test Name |
|
| (Optional) Test ID from the Test Management platform/framework . |
|
| Starting time of the test (milliseconds since epoch) |
|
| Ending time of the test (milliseconds since epoch) |
|
| Test status: |
|
Request Samples
Sample Shell command and response:
Delete Test Session
Delete test session when sending of test events has been done.
Calling this request will close the test session and update the coverage.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| Test Session ID |
|
Request Samples
Sample Shell command and response:
Force “Full-Run” on a Test Stage
This request will schedule a “full run” for the subsequent execution of a specified Test Stage.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| App to schedule full run for |
|
| Branch to schedule full run for |
|
| Test Stage to schedule full run for |
|
Request Body
Parameter | Description | Is mandatory? |
---|---|---|
| Boolean indicator, indicates if next run will be full run or not |
|
Request Samples
Sample Shell command and response:
Get Recommended Tests (White List)
Get Recommended Tests for the latest build from a specific app/branch
Get recommendations for the latest build for a specific app/branch: it returns a list of test names recommended to be run.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
appName | App name | |
branchName | Branch name | |
testStage | Test Stage name |
Request/Response Samples
Sample | Request | Response |
---|---|---|
Default |
|
|
Sample Shell command and response:
Get Recommended Tests by BSID and Test-Stage
Get recommendations for a specific build according to buildSessionId: it will return a list of test names that are recommended to be run for the given build.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
bsId | Build session Id | |
testStage | Test Stage name | |
offset | Result offset - used for pagination |
|
limit | Result limit - used for pagination (max limit 100,000 records) |
|
search | Free text to filter the recommednations by |
|
sortBy | Sort recommnedations bym options are:
|
|
sortDirection | Sort recommendations direction, options are:
|
|
facet | Saved filters according to recommendations` types, options are:
|
|
Request Samples
Response Sample
Sample Shell command and response:
Get Recommended Tests by app name, branch name, build name and Test Stage
Get recommendations for a specific build according to app/branch/build-name.
Calling this request for getting a list of test names that are recommended to be run for the given build.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
appName | App name | |
branchName | Branch name | |
buildName | Build name | |
testStage | Test Stage name | |
offset | Result offset - used for pagination |
|
limit | Result limit - used for pagination (max limit 100,000 records) |
|
search | Free text to filter the recommednations by |
|
sortBy | Sort recommnedations bym options are:
|
|
sortDirection | Sort recommendations direction, options are:
|
|
facet | Saved filters according to recommendations` types, options are:
|
|
Request Samples
Response Sample
Sample Shell command and response:
Get Executions Status List
Calling this request will respond with a status of all executions that are suitable for the request.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
| Build session Id |
|
| Lab Id |
|
| Test Stage |
|
| enum:
|
|
Request Samples
Response Sample
Sample Shell command and response:
Get Test Runs
Get Test Runs by buildSessionId and Test-Stage
Get test runs for a specific build according to the build session ID and test stage.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
bsId | Build session Id | |
testStage | Test Stage name | |
testGroupId | Id of the test group |
|
offset | Result offset - used for pagination |
|
limit | Result limit - used for pagination (max limit 100,000 records) |
|
Request Samples
Response Sample
Sample Shell command and response:
Get Test Runs by app name, branch name, build name and Test Stage
Get test runs for a specific build according to the app name, branch name, build name and test stage.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
appName | App Name | |
branchName | Branch Name | |
buildName | Build Name | |
testStage | Test Stage name | |
testGroupId | Id of the test group |
|
offset | Result offset - used for pagination |
|
limit | Result limit - used for pagination (max limit 100,000 records) |
|
Request Samples
Response Sample
Sample Shell command and response:
Get Test Runs by latest build on app name, branch name and Test Stage
Get test runs for a specific build according to the app name, branch name, build name and test stage.
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
appName | App Name | |
branchName | Branch Name | |
testStage | Test Stage name | |
testGroupId | Id of the test group |
|
offset | Result offset - used for pagination |
|
limit | Result limit - used for pagination (max limit 100,000 records) |
|
Request Samples
Response Sample
Sample Shell command and response:
Recalculation
Get Previous Build to Recalculate
Get a list of previous builds that the TIA can re-calculate against them
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
bsId | Build Session Id | |
testStage | Test stage name | |
offset | Result offset - Used for pagination |
|
limit | Result limit - Used for pagination (max limit 100,000 records) |
|
branchName | Limit query to a specific branch |
|
Request Sample
Response Sample
Sample Shell command and response:
Re-calculate Recommendations Based on Baseline BuildSessionId
Re-calculation of recommendations to specific build and test stage
Request details
Parameter | Description | Is mandatory? |
---|---|---|
bsId | Build Session Id | |
testStage | Test stage name | |
baselineBsId | Build Session ID against which to recalculate |
Request Sample
Response Sample
Sample Shell Command and Response:
Enable/Disable TIA
Enable/Disable TIA for a given app/branch
Request details
Request parameters
Parameter | Description | Is mandatory? |
---|---|---|
appName | App Name | |
branchName | Branch Name | |
testStage | Test Stage name |
Request body
Parameter | Description | Default value | Is mandatory? |
---|---|---|---|
| Enable/Disable TIA |
|
|
Request Samples
Sample Shell command and response:
Linux | |
---|---|
Powershell |