Cloud Runner TestGenerationApi – Scoped, Global
Manages test job generation to be executed in a cloud runner for Automated Test Framework (ATF). This API is part of the CloudRunnerApi script include.
- Start the test generation job.
- Check the progress of the test generation job.
- Cancel the test generation 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.
TestGenerationApi – cancelJob(String snboqId)
Sets the test generation job and its associated update set record to complete status. Cancels the root trackers of any generated tests that are running. If any test jobs are in progress on cancellation, this method sets any of the in-progress test records generated to skipped.
| Name | Type | Description |
|---|---|---|
| snboqId | String | Required. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table. |
| Type | Description |
|---|---|
| null | Null if successful, error message otherwise. |
The following example shows how to start generating tests for the incident table and cancel the test generation. In the global scope, use the sn_atf_tg namespace.
var insertedSnboqId = CloudRunnerAPI.TestGenerationAPI.startJob({
tableEncodedQuery: "nameISincident",
catalogEncodedQuery: "sysIdISEMPTY",
maxTestCount: 10
});
CloudRunnerAPI.TestGenerationAPI.cancelJob({snboqId: insertedSnboqId});
TestGenerationApi – progress(String snboqId)
Provides the status of each generated test for a provided Browser Orchestration Queue (BOQ) record.
| Name | Type | Description |
|---|---|---|
| snboqId | String | Required. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table. |
| Type | Description |
|---|---|
| Object | Information about the test job. You can find advanced test details in the Generated Tests [sn_atf_tg_generated_test] table. |
| testsFailed | The number of failed tests generated. The failure reasons are listed in the Generated Tests [sn_atf_tg_generated_test] table. Data type: Number |
| testsInProgress | The number of use cases being created. Data type: Number |
| testsPending | The number of use cases remaining to be generated. Data type: Number |
| testsSkipped | The number of tests skipped due to job cancellation. Data type: Number |
| testsSucceeded | The number of successfully generated tests. Data type: Number |
The following example shows how to start generating tests for the incident table, get the progress, and cancel the test generation. In the global scope, use the sn_atf_tg namespace.
var snboqId = CloudRunnerAPI.TestGenerationAPI.startJob({
"tableEncodedQuery": "nameISincident",
"catalogEncodedQuery": "sysIdISEMPTY",
"maxTestCount": 10
});
gs.info(JSON.stringify(CloudRunnerAPI.TestGenerationAPI.progress({snboqId: snboqId})));
CloudRunnerAPI.TestGenerationAPI.cancelJob({"snboqId": snboqId});
Output:
{
"testsSucceeded": 4,
"testsFailed": 2,
"testsPending": 2,
"testsInProgress": 8,
"testsSkipped": 0
}
TestGenerationApi – startJob(String tableEncodedQuery, String userEncodedQuery, String catalogEncodedQuery, Number maxTestCount, Number maxTestCountPerTable, Number maxTestCountPerItem, String email, Boolean separateUpdateSetPerScope, String scopeForGeneratingTests, String suiteName)
Inserts a record into the Browser Orchestration Queue (BOQ) [sn_atf_tg_sn_boq] table to start a test job.
| Name | Type | Description |
|---|---|---|
| catalogEncodedQuery | String | Optional. Encoded query specifying the catalog items (CIs) on which to generate tests. Default: All CIs (empty string) |
| String | Optional. Email address to send a notification to when the test generation is complete. Default: No email (empty string) |
|
| maxTestCount | Number | Optional. Maximum number of tests to generate. Possible values: 1-9999 Default: 9999 (maximum value) |
| maxTestCountPerItem | Number | Optional. Maximum number of tests to generate per CI. Possible values: 1-10 Default: 10 (maximum value) |
| maxTestCountPerTable | Number | Optional. Maximum number of tests to generate per table. Possible values: 1-10 Default: 10 (maximum value) |
| scopeForGeneratingTests | String | Required when separateUpdateSetPerScope is set to false. Sys_id of the scope in which to place all generated tests. Default: No sys_id (empty string) |
| separateUpdateSetPerScope | Boolean | Optional. Flag that indicates whether to separate generated tests into respective suites, update sets, and scopes, or to place tests into one suite, update set, and scope. Valid values:
Default: true |
| testSuite | String | Optional. Sets the name of the test suite to create via test generation. Data type: String Default: ATF Generated Suite - <time_stamp> |
| tableEncodedQuery | String | Optional. Encoded query specifying the tables on which to generate tests. See Encoded query strings. Default: All tables (empty string) |
| userEncodedQuery | String | Optional. Encoded query specifying the users on which to generate tests. Default: All users (empty string) |
| Type | Description |
|---|---|
| String | The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table. |
The following example shows how to start generating tests for the incident table. In the global scope, use the sn_atf_tg namespace.
var insertedSnboqId = CloudRunnerAPI.TestGenerationAPI.startJob({
tableEncodedQuery: "nameISincident",
catalogEncodedQuery: "sysIdISEMPTY",
suiteName: "Suite123",
maxTestCount: 10
});
gs.info(insertedSnboqId);
Output:
<sys_id of inserted BOQ record>