Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space CPPTDESKDEV and version 10.4.1


Adding Test Case Parameterization
Adding Test Case Parameterization
Adding Test Case Parameterization

You can use the Parameters step when the testing scenario requires the execution of the Parameterization allows you to execute the same test with a different set of pre- and post-condition values. You can define an arbitrary set of variables in a parameters tablebuilt-in table or in an external data source, such as a CSV file. Each variable has its own column with a unique user-assigned name.  Parameterized test cases will be executed independently for each row of values.

Variables defined in Parameters can be used in various steps, for example:


You can add test case parametrization in one of the following ways:

  • by creating a new test case using the Create new parameterized test case option (see Using Data Sources to Parameterize Test Cases); this will add the Parameters step to the test case and automatically update the test case with the default values,
  • by manually adding a Parameters step to an already existing test case.

The variables you define in the Parameters step can be used in other steps, for example, as initializers of pre-condition variables (Variables step), as expected post-condition values (Assertions step)


, as stub configuration parameters




Variables from the Parameters table can be accessed using the following Parameters API. These access functions define the parameter typestep). The other steps can access the variables by using the Parameters API. The following data source macros are available:

  • CPPTEST_DS_GET_BOOL("<column name with bool values>")
  • CPPTEST_DS_GET_CSTR("<column name with string values>")
  • CPPTEST_DS_GET_FLOAT("<column name with float values>")
  • CPPTEST_DS_GET_INTEGER("<column name with integer values>")
  • CPPTEST_DS_GET_CHAR ("<column name with char values>")
  • CPPTEST_DS_GET_UINTEGER("<column name with unsigned integer values>")
  • CPPTEST_DS_GET_MEM_BUFFER ("<column name with buffer data>", "<size of data>")
  • CPPTEST_DS_GET_ENUM ("<enum type name>", "<column name with enum values>")

Press CTRL+SPACE in the target to access the Parameters API step.

Additional Parameter Step Details

(info) Only simple type values are supported by the Parameters Step.


column name example
column name example

The following example shows a parameterized test case for processValue(




. The values specified in the built-in table are applied in the Variables, Stub Configuration, and Assertions steps using a data source macro and the column name.

Image Added

Configuring the Parameters Step

The following options are available to configure the Parameters step:

Image Added

  • Built-in (table) radio button - adds a table for specifying parametrization values to your test case
  • Data source radio button - defines an external data source for specifying parametrization values
  • Create new data source icon- creates a new external data source
  • Edit data source icon - opens the data source
  • Open data source file icon - opens an existing data source file
  • Update column names icon - displays the column names
  • Parameterize test case... icon - opens the dialog that allows you to:
    - customize the column naming pattern for the data source
    - automatically update the test case with the values from the columns that match the pattern (see Parameterizing the Test Case)

Parameterizing the Test Case
Parameterizing the Test Case
Parameterizing the Test Case

To parameterize the test case with values specified in the data source you've added:

  1. Click the Parameterize test case... icon to open the Test Case Editor dialog.
    Image Added

  2. Specify the column naming pattern. The pattern must include the following:
    {CONTEXT} - the context where the value obtained from the column will be used. The following contexts are available:
          V indicates the Variables step
          A indicates the Assertions step
          SV indicates the SET VALUE action type in the Stub Configuration step
          SA indicates an assertion in the Stub Configuration step
    {TYPE} - the data source macro that will be used to obtain the value. The following data types are available:
          I indicates CPPTEST_DS_GET_INTEGER
          F indicates CPPTEST_DS_GET_FLOAT
          S indicates CPPTEST_DS_GET_CSTR
          C indicates CPPTEST_DS_GET_CHAR
          B indicates CPPTEST_DS_GET_BOOL
          U indicates CPPTEST_DS_GET_UINTEGER
          M(<size>) indicates CPPTEST_DS_GET_MEM_BUFFER
          E(<type>) indicates CPPTEST_DS_GET_ENUM
    {VARIABLE} - the name of the variable
    (info) The default is {CONTEXT}#{TYPE}#{VARIABLE} (see Example).

    Image Added
  3. Click OK. The test case will be updated with values specified in the data source columns that match the pattern.

Reporting Values and Messages