Cloud Runner TestRunnerApi – Scoped, Global
Manages tests to be executed in a cloud runner for Automated Test Framework (ATF). This API is part of the CloudRunnerApi script include.
You can use this API for the following tasks:
- Start an ATF test or test suite in the Cloud Runner browser.
- Check the progress of the test job.
- Cancel the test job.
In global scope, this API is executed within the sn_atf_tg namespace. You must have the ATF Test Generator and Cloud Runner (sn_atf_tg) plugin activated to use this API.
See also:
- Cloud Runner TestGenerationApi – Scoped, Global
- Cloud Runner TestUserApi – Scoped, Global
- Cloud Runner Test User REST API
Parent Topic:Server API reference
TestRunnerApi – cancelJob(String snboqId)
Sets the test runner job to complete status and cancels any generated tests that are running.
| Name | Type | Description |
|---|---|---|
| snboqId | String | Sys_id of the Browser Orchestration Queue (BOQ) [sn_atf_tg_sn_boq] record associated with the test runner job to cancel. |
| Type | Description |
|---|---|
| null | Null if successful, error message otherwise. |
The following example shows how to cancel a test job using snboqId:
var testRunnerApi = new sn_atf_tg.TestRunnerApi();
// Cancel job using snboqId
var cancelResult = testRunnerApi.cancelJob('f6e5d4c3b2a1908070605040302010ab', null);
if (cancelResult.status === 'success') {
gs.info('Test job cancelled successfully');
} else {
gs.error('Failed to cancel test job: ' + cancelResult.message);
}
Output:
Test job cancelled successfully
TestRunnerApi – progress(String snboqId)
Provides the status of each test ran for a provided Browser Orchestration Queue (BOQ) record.
| Name | Type | Description |
|---|---|---|
| snboqId | String | Sys_id of the Browser Orchestration Queue (BOQ) [sn_atf_tg_sn_boq] record associated with the test runner job to retrieve. |
| Type | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Object | JSON object indicating test progress. | ||||||||||
| Object.progress | Indicates test progress percentage complete.Type: Number | ||||||||||
| Object.state | State of the record.Possible values: - `Pending`: The requested test activity has been created and is waiting to be executed. - `Processing`: The instance is scanning for records to ensure that the execution trackers are marked for cloud runner before the request is sent to the cloud infrastructure. - `Browsers requested`: A request has been sent to the cloud infrastructure to start browsers for test generation or test running. - `Running`: Cloud infrastructure browsers find and execute pending tests. - `Completed`: The test task is complete. - `Failed state`: The test task failed. Type: String | ||||||||||
| Error | If unsuccessful, possible error messages:- No sys\_id passed in – The JSON object provided doesn’t have a BOQ ID entry. Verify that the JSON object is structured as `{snboqId: " The following example shows how to start a test run an ATF test, display the progress, and stop the test run. In the global scope, use the sn_atf_tg namespace. Output: TestRunnerApi – startJob(String testId)Starts an ATF test or a test suite on the Cloud Runner browser.
The following example shows how to start a test run an ATF test, display the progress, and stop the test run. In the global scope, use the sn_atf_tg namespace. Output: |