What This Table Is
The sys_atf_test table stores Automated Test Framework test definitions—the actual test cases that validate platform functionality. Each record represents a complete test scenario with its steps, configuration, and execution history. These aren't just test metadata; they're executable test definitions that the ATF engine runs against your instance.
This table belongs to the Development module and supports the entire ATF testing lifecycle—from test creation in the designer to execution in test suites to reporting results. The ATF uses this table to track which tests passed, failed, or were skipped during automated runs, making it central to continuous integration workflows.
The sys_atf_test table doesn't extend any other table—it's a standalone structure. However, it's closely related to sys_atf_test_result (execution results), sys_atf_test_suite (test groupings), and sys_atf_step (individual test step definitions).
In large enterprises, this table typically contains 500-2000 records representing the full test automation suite. Performance is generally good since test definitions are read frequently but written infrequently. The biggest performance consideration is parsing the test_definition JSON field, which can be substantial for complex tests with many steps.
When You'll Script Against This Table
You'll query sys_atf_test primarily in Scheduled Jobs that generate testing reports, Business Rules that trigger test runs based on deployment events, and Script Includes that build custom ATF dashboards. The most common pattern is creating automated reports that show test health across releases or identifying which tests consistently fail.
Access requires the atf_test_designer role to read test definitions and atf_test_admin to modify them. Most scripting happens in global scope since ATF functionality is platform-wide, not application-specific.
- Generate test execution reports showing pass/fail rates by application or suite
- Build custom dashboards that track test coverage across business processes
- Identify tests that haven't run recently and may be obsolete
- Automatically trigger test runs after deployments using deployment Business Rules
- Parse test step definitions to extract which tables and fields are being tested
- Clone and modify test definitions programmatically for similar business processes
- Export test definitions for backup or migration to other instances
Table Gotchas
The test_definition field contains serialized JSON that's not directly queryable. You can't use GlideRecord conditions to filter by specific test steps—you must retrieve the record and parse the JSON in JavaScript.
The state field shows the test's execution status, but 'draft' tests can still be run manually. Don't assume state='active' is required for execution—check the last run date instead.
- The
expected_durationfield is calculated from historical runs and gets updated after each execution, making it unreliable for new tests - ATF tests can reference other tests via the
copied_fromfield, creating dependencies that aren't obvious from the test name alone - Deleting a test doesn't automatically clean up its results in
sys_atf_test_result—you'll accumulate orphaned result records over time
Performance degrades significantly when parsing test_definition JSON for large test suites. Cache parsed results or use GlideAggregate for counts rather than iterating through individual test steps.
- The
applicationfield can be empty for tests that span multiple applications, making application-based reporting incomplete
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
The sys_atf_test_result table is your most common join—it stores the actual execution results for each test run. Every time a test executes, it creates a new result record with pass/fail status, execution time, and step-by-step outcomes. You'll almost always query both tables together when building test reports or dashboards.
The sys_atf_test_suite table groups tests into logical collections for batch execution, while sys_atf_test_suite_test creates the many-to-many relationship between suites and tests. When reporting on test coverage by functional area, you'll often join through these tables to group results by business process.
The sys_atf_step table defines the available test step types (like "Set field values" or "Run server script"), while sys_app provides application context for organizing tests by functional area. These relationships help when building comprehensive test coverage reports or identifying gaps in your automation strategy.