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

Cloud Runner TestUserApi – Scoped, Global

Manages test user jobs 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 user test job.
  • Set the cloud user.
  • Check if the user specified is valid.
  • Check the progress of the user 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:

Parent Topic:Server API reference

TestUserApi – cancelJob(String snboqId)

Sets the test user job status in the Browser Orchestration Queue [sn_atf_tg_sn_boq] table to complete.

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.
ErrorIf 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: ""}`. - Invalid sys\_id passed in – The ID provided must be for a BOQ record in the Browser Orchestration Queue \[sn\_atf\_tg\_sn\_boq\] table.

The following example shows how to start a test user for the admin user, get the progress, and cancel the test user. After confirming the locked out user as a valid cloud user, the code sets the cloud user as an ITIL administrator. In the global scope, use the sn_atf_tg namespace.

var snboqId = CloudRunnerAPI.TestUserAPI.startJob({username: "abel.tuter"});

gs.info(JSON.stringify(CloudRunnerAPI.TestUserAPI.progress({snboqId: snboqId})));

CloudRunnerAPI.TestUserAPI.cancelJob({snboqId: snboqId});

gs.info(CloudRunnerAPI.TestUserAPI.isValidCloudUser({username: <name of the user who has been locked out>}));

CloudRunnerAPI.TestUserAPI.selectCloudUser({username: "itil_admin"});

Output:

{progress: 64, state: running}
User is missing the following criteria: 
    User is locked out
False

TestUserApi – isValidCloudUser(String username)

Checks whether a provided user is a valid cloud user.

NameTypeDescription
usernameObjectRequired. User ID of a valid user listed in the Users [sys_user] table. This value is provided as a string in a JSON object. For example, {username: "abel.tuter"}.
TypeDescription
BooleanFlag that indicates whether the user provided is a valid cloud user. Valid values: - true: The user provided is a valid cloud user. - false: The user provided is invalid for one or more of the following reasons: - The user wasn’t found. - The user is inactive. - The user is locked out. - The user needs a password reset. - The user doesn’t have an admin role. - The user has read-only access. - The user has web services only access.

The following example shows how to start a test user for the admin user, get the progress, and cancel the test user. After confirming the locked out user as a valid cloud user, the code sets the cloud user as an ITIL administrator. In the global scope, use the sn_atf_tg namespace.

var snboqId = CloudRunnerAPI.TestUserAPI.startJob({username: "abel.tuter"});

gs.info(JSON.stringify(CloudRunnerAPI.TestUserAPI.progress({snboqId: snboqId})));

CloudRunnerAPI.TestUserAPI.cancelJob({snboqId: snboqId});

gs.info(CloudRunnerAPI.TestUserAPI.isValidCloudUser({username: <name of the user who has been locked out>}));

CloudRunnerAPI.TestUserAPI.selectCloudUser({username: "itil_admin"});

Output:

{progress: 64, state: running}
User is missing the following criteria: 
    User is locked out
False

TestUserApi – progress(String snboqId)

Provides the status of each user 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
ObjectJSON object indicating test progress.
{
  "progress": Number,
  "state": "String"
}
Object.progressIndicates test progress percentage complete.Type: Number
Object.stateState 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
ErrorIf 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: ""}`. - Invalid sys\_id passed in – The ID provided must be for a BOQ record in the Browser Orchestration Queue \[sn\_atf\_tg\_sn\_boq\] table.

The following example shows how to start a test user for the admin user, get the progress, and cancel the test user. After confirming the locked out user as a valid cloud user, the code sets the cloud user as an ITIL administrator. In the global scope, use the sn_atf_tg namespace.

var snboqId = CloudRunnerAPI.TestUserAPI.startJob({username: "abel.tuter"});

gs.info(JSON.stringify(CloudRunnerAPI.TestUserAPI.progress({snboqId: snboqId})));

CloudRunnerAPI.TestUserAPI.cancelJob({snboqId: snboqId});

gs.info(CloudRunnerAPI.TestUserAPI.isValidCloudUser({username: <name of the user who has been locked out>}));

CloudRunnerAPI.TestUserAPI.selectCloudUser({username: "itil_admin"});

Output:

{progress: 64, state: running}
User is missing the following criteria: 
    User is locked out
False

TestUserApi – selectCloudUser(String username)

Starts an end-to-end test user job on cloud runner. If the user is able to log in correctly with the admin role, then the cloud user property is set as this user for future test runs and test generations on the cloud runner infrastructure.

NameTypeDescription
usernameObjectRequired. User ID of a valid user listed in the Users [sys_user] table. This value is provided as a string in a JSON object. For example, {username: "abel.tuter"}.
TypeDescription
NullNull if successful. Error message otherwise.`Unable to set cloud user as cloud user not valid` – This error indicates that the user provided is invalid for one or more of the following reasons: - The user wasn’t found. - The user is inactive. - The user is locked out. - The user needs a password reset. - The user doesn’t have an admin role. - The user has read-only access. - The user has web services only access.

The following example shows how to start a test user for the admin user, get the progress, and cancel the test user. After confirming the locked out user as a valid cloud user, the code sets the cloud user as an ITIL administrator. In the global scope, use the sn_atf_tg namespace.

var snboqId = CloudRunnerAPI.TestUserAPI.startJob({username: "abel.tuter"});

gs.info(JSON.stringify(CloudRunnerAPI.TestUserAPI.progress({snboqId: snboqId})));

CloudRunnerAPI.TestUserAPI.cancelJob({snboqId: snboqId});

gs.info(CloudRunnerAPI.TestUserAPI.isValidCloudUser({username: <name of the user who has been locked out>}));

CloudRunnerAPI.TestUserAPI.selectCloudUser({username: "itil_admin"});

Output:

{progress: 64, state: running}
User is missing the following criteria: 
    User is locked out
False

TestUserApi – startJob(String username)

Starts an end to end test user job on cloud runner.

NameTypeDescription
usernameStringRequired. User name of sys_user to test the end to end infrastructure of cloud runner.
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 a test user for the admin user, get the progress, and cancel the test user. After confirming the locked out user as a valid cloud user, the code sets the cloud user as an ITIL administrator. In the global scope, use the sn_atf_tg namespace.

var snboqId = CloudRunnerAPI.TestUserAPI.startJob({username: "abel.tuter"});

gs.info(JSON.stringify(CloudRunnerAPI.TestUserAPI.progress({snboqId: snboqId})));

CloudRunnerAPI.TestUserAPI.cancelJob({snboqId: snboqId});

gs.info(CloudRunnerAPI.TestUserAPI.isValidCloudUser({username: <name of the user who has been locked out>}));

CloudRunnerAPI.TestUserAPI.selectCloudUser({username: "itil_admin"});

Output:

{progress: 64, state: running}
User is missing the following criteria: 
    User is locked out
False

sndocs is an independent community mirror and is not affiliated with or endorsed by ServiceNow.

ServiceNow, the ServiceNow logo, Now, and other ServiceNow marks are trademarks and/or registered trademarks of ServiceNow, Inc., in the United States and/or other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

© 2026 ServiceNow, Inc. All rights reserved.

Documentation content is redistributed under the Apache License 2.0 from the ServiceNowDocs repository.