{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1880,"path":"application-development/build-agent-testing.md","title":"Test what you built with Build Agent","bundle":null,"doc_type":null,"release":"australia","body":"\n# Test what you built with Build Agent\n\nTest Agent generates test coverage for code created by Build Agent or Autonomous Engineer, executes tests, and performs root cause analysis \\(RCA\\) on failures. Prompt Test Agent to complete build-to-test workflows in a single development session without manual test authoring or failure investigation.\n\nTest Agent extends Build Agent or Autonomous Engineer by making every build safe before release. After Build Agent or Autonomous Engineer produces code changes in a development instance, Test Agent consumes the same prompt and code context. It uses those to author functional Automated Test Framework \\(ATF\\) tests, execute those tests, and triage any failures automatically.\n\n-   For details on configuring tests in Build Agent, see [Configure auto test prompting and UI tests](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/ba-config-testing.md).\n-   For more information ATF test generation, see [ATF test generation in Build Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/test-agent-atf-test-gen-ba.md).\n-   For complete documentation on using Test Agent, see [Test Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/test-agent-landing-page.md).\n\nIf a test fails, Test Agent performs an RCA. Then it either auto-applies safe fixes or surfaces actionable guidance in the chat panel so you can resolve the issue without leaving ServiceNow Studio or the ServiceNow IDE.\n\n## Customer outcomes\n\nTest Agent delivers the following measurable outcomes:\n\n-   Build and test in one session: You no longer need to context-switch between authoring code and writing tests. Both happen sequentially within the same session.\n-   Faster failure triage: Automated RCA and proposed fixes reduce the time you spend looking through logs after a test run.\n-   More release confidence: Measurable quality gates enforced by automated test execution give you verifiable evidence of code health before promotion to production instances.\n-   Generated ATF tests are stored in the sys\\_atf\\_tests \\[sys\\_atf\\_tests\\] table under the app scope for which they were created. You can schedule regression test runs using the generated tests.\n\n## Test generation prompting\n\nAfter each development action in Build Agent or Autonomous Engineer, Test Agent asks whether to generate ATF tests for what you just built. You can accept or decline the prompt at each step. When you accept the prompt, Test Agent generates tests before returning control to you in the chat panel.\n\n\\[Omitted image \"ba-tests-prompt-for.png\"\\] Alt text: Prompt asking whether to write tests to cover the app, with Yes, proceed selected and a Submit button.\n\nAutomatic prompting for tests reduces the chance of skipping test coverage during rapid development by keeping test generation as part of the standard development loop.\n\nTo manually prompt for tests, ask Build Agent or Autonomous Engineer to `Generate ATF tests for all the feature permutations on the app we built`. Then, you can tell Build Agent or Autonomous Engineer to `Execute all ATF tests.`\n\n## Test Agent workflow\n\nThe end-to-end workflow is:\n\n1.  Create or edit an app in a development instance using Build Agent in ServiceNow Studio or the ServiceNow IDE, driven by your prompt.\n2.  Alternatively, start from an Autonomous Engineer application plan. Test Agent reads the stories and acceptance criteria in the plan and generates tests automatically as implementation begins, without a separate prompt. For more information on running tests in Autonomous Engineer, see [Autonomous Engineer in Build Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/ba-autonomous-engineer.md).\n3.  Test Agent consumes the prompt and the resulting code changes to generate contextually relevant functional and UI ATF tests.\n4.  Respond to Build Agent asking whether you want to run the tests.\n5.  Failures are automatically triaged. Test Agent produces an RCA and either applies safe fixes autonomously or proposes them to you through the chat panel.\n6.  Build Agent ingests the RCA from Test Agent and re-executes tests until a passing status is achieved, completing the auto-heal loop. Stale tests are automatically updated to reflect the newest functionality.\n7.  Alternatively, ask Build Agent to create or run a test suite to execute multiple tests as a group and review consolidated results in the chat panel.\n\n## Key developer experiences for Test Agent in Build Agent\n\n-   **Autonomous test authoring**\n\n    When you use Build Agent to implement a story, you can prompt it to create functional and UI tests automatically.\n\n-   **Test generation from Autonomous Engineer plans**\n\n    When you use Autonomous Engineer to produce an application plan, Build Agent hands off that plan to Test Agent as implementation begins. Test Agent reads each story and its acceptance criteria in the plan and automatically generates Automated Test Framework tests to validate the expected behavior. Generated tests are executed immediately, and any failures are triaged by Test Agent before control returns to you in the chat panel. This closes the loop from planning to tested implementation within a single Build Agent session, without a separate prompt to create or run tests.\n\n-   **UI testing**\n\n    Generate comprehensive UI tests for applications you build with Build Agent. UI testing extends the existing functional test capability to cover browser-level interactions, such as multi-step page navigation flows. Request a UI test by prompting Build Agent to generate a UI test for the application or flow you want to validate. For more information, see [UI Test Script in Automated Test Framework \\(ATF\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/test-agent-ui-test-script-atf.md).\n\n-   **List and related list step generation**\n\n    Test Agent can generate ATF tests that use list and related list test steps, including validate related list visibility and apply filter to list tests. List step support extends test coverage beyond form-based interactions to include list view interactions on the ServiceNow AI Platform. For more information on list and related list test steps, see [List and Related List](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/automated-test-framework-atf/test-steps-list-related-list.md).\n\n-   **Test suite authoring and execution**\n\n    Create ATF test suites and edit existing ones from Build Agent. Group individual tests under a suite and execute the suite from the chat panel to run regression testing without selecting individual tests. Execution status and any errors are reported in the chat panel. For more information on test suites, see [Building and running automated test suites](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/automated-test-framework-atf/atf-suites-overview.md).\n\n-   **Automatically updated tests**\n\n    Test Agent automatically identifies outdated ATF tests as your application changes, and updates or removes them to keep your test suite aligned with your current code. Tests that no longer map to application artifacts are removed. Tests that partially match updated artifacts are revised to reflect the current implementation. Automatic test maintenance reduces the overhead of keeping ATF tests synchronized with ongoing development and removes the need to manually audit and update tests after each code change.\n\n-   **Auto-healing**\n\n    Build Agent consumes the RCA produced by Test Agent and applies fixes to code or tests, then re-executes the test suite until all tests reach a passing status. This removes the need for developers to manually patch and maintain tests during a session.\n\n-   **Assisted troubleshooting**\n\n    Test Agent automatically troubleshoots failed tests, generates RCAs, and proposes targeted fixes, eliminating manual log investigation.\n\n\n## Scope and availability\n\nTest Agent is available in the following environments and scopes:\n\n|Dimension|Supported values|\n|---------|----------------|\n|Authoring environment|ServiceNow Studio, the ServiceNow IDE, and the ServiceNow SDK \\(execution tool only\\)|\n|Application scope|Global, custom, store|\n|Test types|ATF functional tests, UI tests, and test suitesATF functional and UI tests|\n|Execution target|Cloud Runner lanes|\n\n**Note:** Test execution requires the ATF Test Generator and Cloud Runner app to be installed and a cloud user set up. For more information, see [ATF Test Generator and Cloud Runner](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/atf-tg-cr-intro.md).\n\n**Parent Topic:**[Use Build Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/use-build-agent.md)\n\n"}}