Building and running automated test suites

  • Release version: Xanadu
  • Updated August 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Building and running automated test suites

    Automated test suites in ServiceNow enable you to run a group of tests in a specific order to validate an application or related features. Test suites can include individual tests and other test suites, allowing for multi-level hierarchies (parent and child relationships). This structure helps streamline testing by organizing tests effectively and running them collectively.

    Show full answer Show less

    Key Features

    • Hierarchical Test Suites: Build multi-level hierarchies where test suites can act as both parents and children, enabling complex test organization.
    • Scheduling: Schedule test suites to run automatically at specific times using schedule records and scheduled suite run records. Note that only test suites (not individual tests) can be scheduled, and scheduled runs require an open Scheduled Client Test Runner with matching browser conditions.
    • Filters: Use filters to dynamically add tests to test suites based on matching conditions, reducing manual effort in suite maintenance.
    • Suite Management: Create new test suites, copy existing suites including nested tests and child suites, rename, and modify them easily.
    • Running Tests: Run entire test suites manually or schedule them. You can also immediately execute scheduled UI test suites via script to automate test runs.
    • Re-running Failed Tests: Re-run only the failed tests within a test suite without running the entire suite again, saving time and resources.

    Practical Considerations

    • Ensure a scheduled client test runner is actively running in a browser for suites with form (UI) steps during scheduled runs.
    • Test suites provide consolidated test results and allow testers to receive email notifications upon completion via watchlists.
    • Scheduled tests cannot run on locked or powered-down machines or where the browser is not already open.

    What to Expect

    By grouping tests into suites and utilizing scheduling and filters, you can efficiently manage and automate testing workflows within ServiceNow. This approach reduces manual effort, improves test execution consistency, and enables proactive test management through scheduling and notifications. It also supports targeted reruns of failed tests, enhancing testing efficiency and reliability in your development and deployment processes.

    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

    Grouping tests into test suites offers these 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.

    Figure 1. Example of Test Suite Hierarchy
    Diagram of example test suite hierarchy

    Schedules

    To schedule a test suite, you need three components:
    • 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
    With this model, you can associate a schedule with many different test suites, and vice versa.
    Note:
    You can schedule only test suites, not individual tests. Scheduled tests will run only if there is an open Scheduled Client Test Runner page matching the scheduled suite's browser conditions. Scheduled tests cannot run on a machine that is locked, powered down, or does not already have the browser open.

    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.

    Note:
    See Browser recommendations and requirements for recommendations and requirements for running the client test runner.

    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.