Cloud Runner TestGenerationApi – Scoped, Global

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 3 minutes de lecture
  • 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.

    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.

    Tableau 1. Parameters
    Name Type Description
    snboqId String Required. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table.
    Tableau 2. Returns
    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.

    Tableau 3. Parameters
    Name Type Description
    snboqId String Required. The sys_id of the BOQ record in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table.
    Tableau 4. Returns
    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": Number,
      "testsInProgress": Number,
      "testsPending": Number,
      "testsSkipped": Number,
      "testsSucceeded": Number
    }
    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.

    Tableau 5. Parameters
    Name Type Description
    catalogEncodedQuery String Optional. Encoded query specifying the catalog items (CIs) on which to generate tests.

    Default: All CIs (empty string)

    email 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:
    • 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

    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)

    Tableau 6. Returns
    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>