Generate a test using Test generation

  • Release version: Australia
  • Updated March 12, 2026
  • 3 minutes to read
  • Simplify and automate your testing process with Test generation. Describe your desired test, and ServiceNow Otto empowered Test generation application automatically generates the necessary tests.

    Before you begin

    Starting with the Australia release, legacy Test generation is being prepared for future deprecation. It will be hidden and no longer installed on new instances but will continue to be supported. For details, see the Deprecation Process [KB0867184] article in the Now Support Knowledge Base.

    Role required: admin or now.assist.creator

    Procedure

    1. Navigate to All > Automated Test Framework (ATF) > Tests.
      A list of tests shows up.
    2. Select Create with Otto to create a test using ServiceNow Otto.
      You can also create a regular ATF test by choosing your steps with the standard ATF interface. To create a regular ATF test, select the New button next to the Create with Otto button.
      The ServiceNow IDE or ServiceNow Studio interface shows up with a sample prompt generated by the Build Agent automatically.
    3. Select the + icon under the ServiceNow Otto window on the right to start a new chat.
    4. Enter a prompt in the Build Agent chat panel to create a test or an application, or to run a new or existing test.
      You can achieve the following:
      • Write ATF tests in the global scope by authoring tests from simple prompts, such as validating that all mandatory fields are completed before submitting the Incident form.
      • Execute existing ATF tests.
        Note:
        If you want to execute an existing ATF test using Test Agent, you're expected to create the ATF test before this process. You can now use ServiceNow Otto to create an ATF test. Select the Create with Otto button on the ATF tests list page. If you have Build Agent installed on your instance, you are redirected to the ServiceNow IDE interface. You will see the following message if you don't have Build Agent installed on your instance.

        Screenshot showing the banner message

        See Create new test for more information.

      • Troubleshoot ATF test failures.
      • Use Test Agent, an extension to building or editing apps with Build Agent, to generate ATF tests for newly built or edited functionality, run those tests, and troubleshoot failures directly within the ServiceNow IDE or ServiceNow Studio context.
      The Test Agent starts the process as mentioned in the prompt.

      As you enter a prompt, the interface page displays the associated code for an existing test or the code generated from the prompt.

    5. Review the information in the console.
      Note:
      The content displayed in the console depends on the tasks specified in the prompt.

      For example, if you're executing a test, the process first looks up the sys_id, then builds and installs the latest code. After the build succeeds, it installs the latest changes on the instance and runs the test in the background.

      Note:
      If the test succeeds, the message saying that the test passed shows up on the console.
    6. Optional: If you're creating an application, generate tests based on the business rules and conditions defined in the prompt.
      The agent starts the process as mentioned in the prompt. You can then review the information in the console as mentioned in the previous step. Once the tests are created, you can run them through another prompt.
      Each test displays a message indicating whether it passed or failed.
    7. Optional: Follow the automatic triaging process if the test execution fails.
      When a test fails, the Test Agent automatically starts the troubleshooting process. It identifies the step where the failure occurred and analyzes the root cause. The Test Agent then recommends possible fixes. After you select a recommended option, the Test Agent applies the fix, updates the test code, and reruns the test automatically. When the test passes, it provides a summary of the changes made to resolve the failure.