Parameterized tests

  • Release version: Zurich
  • Updated July 31, 2025
  • 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 Parameterized tests

    Parameterized tests in ServiceNow's Automated Test Framework enable you to run the same test multiple times with different sets of test data. This approach separates test actions from test data, eliminating the need to duplicate test steps for varying inputs, increasing test reuse, and producing individual results for each data set.

    Show full answer Show less

    Key Features

    • Parameters: Variables defined during test design that store specific types of test data (e.g., Sys ID, integer values). Parameters can be shared across tests or exclusive to a single test.
    • Data Sets: Collections of runtime data values assigned to parameters for each test run. You can manually create or import these data sets. Tests will fail if data sets are not defined.
    • Test Execution: Automated Test Framework runs the parameterized test once per data set, maintaining the same test steps and execution order for each run.
    • Test Results: Each run produces a separate result record detailing the parameters and data sets used, allowing clear tracking of outcomes per data variation.
    • Compatibility: Supports standard Automated Test Framework features such as reports, test suites, and data rollback. However, the Run Server Side Script test step is not supported in parameterized tests.

    Practical Application

    To implement parameterized tests, you:

    • Create a test with variables (parameters) to hold test data.
    • Add parameters to specific test steps to capture variable data.
    • Add or import data sets to define the values for parameters during test runs.

    This setup allows you to test multiple scenarios efficiently, such as verifying different incident form field values (e.g., subcategory and priority) without duplicating test steps.

    Design Considerations

    • Copying a parameterized test copies all associated parameters, data sets, and test steps.
    • When using Custom UI test steps, only the first data set is used to retrieve components.

    Run a test multiple times with different test data for each run. Create parameters to store test data for each test run.

    Parameterized testing offers test designers these benefits.

    • Eliminates the need to duplicate test steps just to change test data.
    • Increases test reuse by separating test actions from test data.
    • Produces a separate test result for each data set.

    When the test runs, Automated Test Framework replaces the parameters with data set values. For example, you can create a test of the incident form that uses parameter values for the subcategory and priority fields. You can use one data set to test that the Antivirus category produces a high priority incident, and another data set to test that the Email category produces a low priority incident.

    Note:
    The Run Server Side Script test step is not supported in parameterized tests.

    Parameterized test components

    Parameterized tests consist of these components.

    Parameter

    A parameter is a variable that stores a particular type of test data. Each parameter has a unique label and a data type. For example, you can create a parameter to store the Sys ID of a reference field or the integer value of a choice field. Define parameters during test design.

    Parameters can be shared or exclusive. Shared parameters can be used in any parameterized test. Exclusive parameters can only be used with the test for which they were created. Each shared parameter is a column in the Test Run Data Sets [sys_atf_parameter_set] table. Each exclusive parameter is a record in the Parameter Variables [sys_atf_parameter_variable] table.

    Data set

    A data set, also known as a test run data set, includes runtime data used when the test runs. You can set a value for every parameter available to the current test. Data sets specify the parameter value during test runs. You can manually create data sets for a test, or import data from a file. Each data set is a record in the Test Run Data Sets [sys_atf_parameter_set] table.

    Parameterized tests fail if data sets are not defined.

    Design Considerations

    Follow these design considerations when creating parameterized tests.

    • Parameterized tests support standard Automated Test Framework features, such as reports, test suites, and data rollback. Copying a parameterized test copies all parameters, test run data sets, and test steps.
    • If you create a parameterized test that includes Custom UI test steps, the system only uses the first data set to retrieve components.

    Parameterized test runs

    Automated Test Framework runs each parameterized test once per data set, using the same test steps and execution order. For example, if a parameterized test has five data sets, Automated Test Framework runs the test five times, once for each data set.

    Parameterized test results

    Parameterized tests display test results by the execution order of the data sets. Open each test result record to view the test details.

    Parameterized test results display multiple records.

    The Parameterized Test Result record Description field lists the parameters and data sets used in the test run.