Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

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.

You can use this API for the following tasks:

  • 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.

See also:

Parent Topic:Server API reference

TestGenerationApi – cancelJob(String snboqId)

Sets the test generation job and its associated update set record to complete status. If any test jobs are in progress on cancellation, this method sets any of the in-progress test records generated to skipped.

NameTypeDescription
snboqIdStringRequired. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table.
TypeDescription
nullNull 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.

NameTypeDescription
snboqIdStringRequired. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table.
TypeDescription
ObjectInformation about the test job. You can find advanced test details in the Generated Tests \[sn\_atf\_tg\_generated\_test\] table.
{
  "testsFailed": Number,
  "testsInProgress": Number,
  "testsPending": Number,
  "testsSkipped": Number,
  "testsSucceeded": Number
}
testsFailedThe number of failed tests generated. The failure reasons are listed in the Generated Tests \[sn\_atf\_tg\_generated\_test\] table.Data type: Number
testsInProgressThe number of use cases being created.Data type: Number
testsPendingThe number of use cases remaining to be generated.Data type: Number
testsSkippedThe number of tests skipped due to job cancellation.Data type: Number
testsSucceededThe 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.

NameTypeDescription
catalogEncodedQueryStringOptional. Encoded query specifying the catalog items \(CIs\) on which to generate tests.Default: All CIs \(empty string\)
emailStringOptional. Email address to send a notification to when the test generation is complete.Default: No email \(empty string\)
maxTestCountNumberOptional. Maximum number of tests to generate.Possible values: 1-9999 Default: 9999 \(maximum value\)
maxTestCountPerItemNumberOptional. Maximum number of tests to generate per CI.Possible values: 1-10 Default: 10 \(maximum value\)
maxTestCountPerTableNumberOptional. Maximum number of tests to generate per table.Possible values: 1-10 Default: 10 \(maximum value\)
scopeForGeneratingTestsStringRequired when separateUpdateSetPerScope is set to false. Sys_id of the scope in which to place all generated tests.Default: No sys_id (empty string)
separateUpdateSetPerScopeBoolean

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:

  • true: Tests are placed into their respective suite and update set according to the scope of each table or catalog item.
  • false: All generated tests are placed in the same suite, update set, and scope. If false, scopeForGeneratingTests is required in the request.

Default: true

testSuiteStringOptional. Sets the name of the test suite to create via test generation.Data type: String Default: ATF Generated Suite - <time\_stamp>
tableEncodedQueryStringOptional. Encoded query specifying the tables on which to generate tests. See Encoded query strings.Default: All tables \(empty string\)
userEncodedQueryStringOptional. Encoded query specifying the users on which to generate tests.Default: All users \(empty string\)
TypeDescription
StringThe 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>