Building and running automated test suites
Summarize
Summary of Building and running automated test suites
ServiceNow’s Automated Test Framework (ATF) enables you to group individual tests and test suites into hierarchical test suites that can be run in a specific order. A test suite can contain both individual tests and child test suites, forming multi-level hierarchies. This structure allows you to efficiently test applications or related features by executing all tests within a suite with a single action.
Show less
Key Features
- Hierarchical Test Suites: Supports parent-child relationships where test suites can contain other test suites or tests, but tests contain only test steps.
- Scheduling: You can schedule test suites to run automatically by creating schedule records and associating them with test suites. Scheduled runs require an active Scheduled Client Test Runner matching browser conditions.
- Dynamic Test Inclusion via Filters: Use filters to automatically add tests to test suites based on matching conditions, reducing manual maintenance.
- Test Suite Management: Create, copy, rename, and modify test suites to streamline test organization. Copying a suite replicates all nested tests and child suites.
- Running Tests: Run test suites manually or schedule them to run at specific times. You can also trigger scheduled test suite runs immediately via scripts for automation.
- Re-running Failed Tests: Efficiently re-run only the failed tests within a suite without executing the entire suite again.
- Notifications: Set a watchlist on test suite runs to notify users by email upon completion.
Practical Considerations for ServiceNow Customers
- Only test suites—not individual tests—can be scheduled for automated execution.
- Scheduled test runs depend on an open Scheduled Client Test Runner; ensure client machines are unlocked, powered on, and have the browser running.
- Form steps requiring UI interaction need an active client test runner during scheduled executions.
- Using filters to build test suites helps reduce manual effort and keeps test suites current as tests evolve.
- Hierarchical test suites allow complex application workflows to be tested in an organized, scalable manner.
Next Steps
To implement automated testing at scale, start by grouping tests into suites and scheduling them to run in non-production instances. Use filters to maintain dynamic test collections and leverage scripting to automate test execution further. Monitor test results and re-run failed tests selectively to optimize testing efficiency.
Run a group of tests in a specific order to test an application or a group of related features.
A test suite can contain both individual tests and other test suites. A test suite that contains another test suite is called a parent, and the test suite contained within the parent is called a child. While a test suite can have both individual tests and test suites as children, tests cannot have other tests as children. Tests can only contain test steps.
Benefits
- Allows testers to run every test in a test suite with one action.
- Allows testers to run all child test suites in a parent test suite.
- Allows testers to see test results for every test in a test suite.
- Allows test designers and testers to schedule when to run test suites.
- Allows test designers and testers to schedule starting client test runners to support test runs.
Hierarchies
Automated Test Framework supports building a multi-level hierarchies where a test suite can be both a parent and child. For example, this figure illustrates Test Suite 1 as the parent at the top of the hierarchy. Test Suite 1.3 is a child of Test Suite 1 and also a parent of Test Suite 1.3.1 and Test Suite 1.3.2.
Schedules
- a test suite record
- a schedule record specifying when you want the system to run the test suite
- a scheduled suite run record that associates the test suite to run with the schedule for running it
The watchlist on the test suite run record also allows you to specify users to receive an email when the system finishes executing the test suite run.
If the test suite contains one or more form steps (steps involving a user interface), you must ensure that a scheduled client test runner is actively running in a browser when the schedule triggers the suite run.
For step-by-step instructions on how to schedule a test suite, see Schedule an automated test suite.
Filters
Automate the creation of test suites by using a filter to dynamically add tests to a test suite when they match the filter conditions. Reduce the time that your test designers spend manually creating and maintaining test suites.