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

Cloud Runner Test Generation REST API

Manages test job generation to be executed in a cloud runner for Automated Test Framework (ATF).

The Cloud Runner Test Generation API requires the ATF Test Generator and Cloud Runner (sn_atf_tg) plugin. The methods available with this API run in the now namespace and can be called using API Name, One-click regression testing for ATF, in the REST API Explorer. The admin role is required to access this API.

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.

The Cloud Runner Test Generation API may be used in tandem with the Cloud Runner Test Runner REST API and Cloud Runner Test User REST API. For instance, you can call the Test Generation API to run a test and then get the progress of the test in the browser orchestration queue (Cloud Runner TEST Generation API) and then check the number of tests that passed or failed.

To view the Server API reference documentation of this API, see Cloud Runner TestGenerationApi – Scoped, Global.

Parent Topic:REST API reference

Cloud Runner Test Generation - GET /now/sn_atf_tg/test_generation_progress

Provides the status of each generated test for a provided Browser Orchestration Queue (BOQ) record.

URL format

Default URL: GET /api/now/sn_atf_tg/test_generation_progress

Supported request parameters

NameDescription
None 
NameDescription
snboqIdRequired. The BOQ record sys\_id of the test generation job to get the progress of.Data type: String Table: BOQ \[sn\_atf\_tg\_sn\_boq\]
NameDescription
None 

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

HeaderDescription
AcceptData format of the response body. Supported types: application/json or application/xml. Default: application/json
HeaderDescription
None 

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Status codeDescription
200Successfully retrieved the progress of the BOQ job.
400Error getting BOQ record status. Returns one of the following messages:- No BOQ ID passed in – No BOQ ID was provided. Add the BOQ ID to the request body. - Unable to find BOQ record – Invalid Sys ID. Verify that the sys\_id of the BOQ record is valid and the record exists.
403Error granting user access to the endpoint. Ensure that the user has the admin role.

Response body parameters (JSON or XML)

NameDescription
resultObject containing the progress results of the generated test job or a message explaining why the request failed.Data type: Object
"result": { 
    "testsSucceeded": Number, 
    "testsFailed": Number, 
    "testsPending": Number, 
    "testsInProgress": Number, 
    "testsSkipped": Number 
  } 
}
Or:
{
  "result": { 
    "message": "String" 
  } 
}
result.messageError message detailing why the test generation progress cannot be retrieved. The message parameter is not returned in a successful response.Data type: String
result.testsSucceededNumber of generated tests that passed.Data type: Number
result.testsFailedNumber of generated tests that failed.Data type: Number
result.testsPendingNumber of use cases that are waiting for generated tests.Data type: Number
result.testsInProgressNumber of use cases that tests are created for.Data type: Number
result.testsSkippedNumber of tests skipped due to the job cancellation.Data type: Number

cURL request

The following GET call returns progress information about generated tests associated with the snboqId 1234.

curl "https://instance.service-now.com/api/now/sn_atf_tg/test_generation_progress?snboqId=1234" \ 
--request GET \ 
--header "Accept:application/json" \ 
--user "username":"password"

Output:

{ 
  "result": { 
    "testsSucceeded": 0, 
    "testsFailed": 0, 
    "testsPending": 0, 
    "testsInProgress": 0, 
    "testsSkipped": 161 
  } 
}

The following example returns a 400 error message when no BOQ ID is passed.

curl "http://instance.service-now.com/api/now/sn_atf_tg/test_generation_progress" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"

Response:

{
  "result": {
    "message": "No SNBOQ ID passed in, add snboqId to request body"
  }
}

The following example returns a 400 error message when an invalid BOQ ID is passed.

curl "http://instance.service-now.com/api/now/sn_atf_tg/test_generation_progress?snboqId=invalid_sys_id" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"

Response:

{
  "result": {
    "message": "Invalid SNBOQ sys_id passed in"
  }
}

Cloud Runner Test Generation - POST /now/sn_atf_tg/cancel_test_generation

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.

Tests can fail or cancel automatically due to business rules or access control rule (ACL) issues. View the generated test table for more details about failed or canceled tests.

URL format

Default URL: POST /api/now/sn_atf_tg/cancel_test_generation

Supported request parameters

NameDescription
None 
NameDescription
None 
NameDescription
snboqIdRequired. Sys\_id of the Browser Orchestration Queue \(BOQ\) record to cancel.Data type: String Table: BOQ \[sn\_atf\_tg\_sn\_boq\]

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

HeaderDescription
AcceptData format of the response body. Supported types: application/json or application/xml. Default: application/json
Content-TypeData format of the request body. Supported types: application/json or application/xml. Default: application/json
HeaderDescription
None 

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Status codeDescription
200Successfully canceled the BOQ job.
400Error canceling job. Returns one of the following messages:- No BOQ ID passed in – No BOQ ID was provided. Add the BOQ ID to the request body. - Unable to find BOQ record – Invalid Sys ID. Verify that the sys\_id of the BOQ record is valid and the record exists.
403Error granting user access to the endpoint. Ensure that the user has the admin role.

Response body parameters (JSON or XML)

NameDescription
resultObject containing the results of the cancellation request.Data type: Object
"result": { 
    "message": "String"
}
result.messageMessage detailing whether the test cancellation was successful.Data type: String

cURL request

The following request cancels the test generation job of a specified BOQ record.

curl "http://instance.service-now.com/api/now/sn_atf_tg/cancel_test_generation" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:application/json" \ 
--data "{\"snboqId\":\"<sys_id of BOQ record>\"}" \ 
--user "username":"password"

The response body returns a success message of the cancellation.

{ 
  "result": { 
    "message": "success" 
  } 
}

The following example returns a 400 error message when no BOQ ID is passed.

curl "http://instance.service-now.com/api/now/sn_atf_tg/cancel_test_generation" \
--request POST \
--header "Accept:application/json" \
--user "username":"password"

Response:

{
  "result": {
    "message": "No SNBOQ ID passed in, add snboqId to request body"
  }
}

The following example returns a 400 error message when an invalid BOQ ID is passed.

curl "http://instance.service-now.com/api/now/sn_atf_tg/cancel_test_generation" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{\"snboqId\":\"invalid_sys_id\"}" \
--user "username":"password"

Response:

{
  "result": {
    "message": "No SNBOQ ID passed in, add snboqId to request body"
  }
}

Cloud Runner Test Generation - POST /now/sn_atf_tg/test_generation

Inserts a record into the Browser Orchestration Queue (BOQ) [sn_atf_tg_sn_boq] table to start a test job.

URL format

Default URL: POST /api/now/sn_atf_tg/test_generation

Supported request parameters

NameDescription
None 
NameDescription
None 
NameDescription
catalogEncodedQueryEncoded query specifying which catalog items to generate tests on. An empty string defaults to all catalog items. For more information about forming encoded queries, see Encoded query strings.Data type: String
emailEmail address to alert when test generation is complete.Data type: String
maxTestCountNumber of overall tests to generate.Accepted values: Any number between 1 and 9999. Data type: Number Default: 9999
maxTestCountPerItemNumber of tests to generate per catalog item. Accepted values: Any number between 1 and 10. Data type: Number Default: 10
maxTestCountPerTableNumber of tests to generate per table. Accepted values: Any number between 1 and 10. Data type: Number Default: 10
scopeForGeneratingTestsRequired when separateUpdateSetPerScope is set to false. Sys_id of the scope in which to place all generated tests. Data type: String
separateUpdateSetPerScope

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.

Data type: Boolean

Default: true

testSuiteOptional. Sets the name of the test suite to create via test generation.Data type: String Default: ATF Generated Suite - <time\_stamp>
tableEncodedQueryEncoded query specifying the tables on which to generate tests. An empty string defaults to all tables. For more information about forming encoded queries, see Encoded query strings.Data type: String
userEncodedQueryEncoded query specifying which users to generate tests on. An empty string input defaults to all tables. For more information about forming encoded queries, see Encoded query strings.Data type: String

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

HeaderDescription
AcceptData format of the response body. Supported types: application/json or application/xml. Default: application/json
Content-TypeData format of the request body. Supported types: application/json or application/xml. Default: application/json
HeaderDescription
None 

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Status codeDescription
200Successfully inserted a test generation BOQ job. Any errors are shown in the BOQ record logs during processing. All inputs default to generate the maximum number of tests for all tables and service catalog items.
403Error granting user access to the endpoint. Ensure that the user has the admin role.

Response body parameters (JSON or XML)

NameDescription
resultObject containing the results of the request.
  "result": { 
    "snboqId": String
  }
Data type: Object
result.snboqIdSys\_id of the record inserted in the sn\_atf\_tg\_sn\_boq table when the test generation starts.Data type: String

cURL request

The following request example starts a new test job in the instance without any request parameters and inserts the job in the BOQ table.

curl "http://instance.service-now.com/api/now/sn_atf_tg/test_generation" \ 
--request POST \ 
--header "Accept:application/json" \ 
--user "username":"password"

Response body:

{ 
  "result": { 
    "snboqId": <sys_id of newly inserted BOQ record> 
  } 
}

The following request example starts a new test job with a maximum test count of 2 and filters the tests to the Incident table, and then inserts the job in the BOQ table.

curl "http://instance.service-now.com/api/now/sn_atf_tg/test_generation" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:application/json" \ 
--data "{\"maxTestCount\":\"2\",\"tableEncodedQuery\":\"name=incident\",\"testSuite\":\"Suite123\"}" \ 
--user "username":"password"

Response body:

{ 
  "result": { 
    "snboqId": <sys_id of newly inserted BOQ record> 
  } 
}