Welcome to the Ranorex Support Portal

Data binding

Now that we’ve defined our variables and assigned the data source to the test case, we’re ready to connect them. This is called data binding, which is the topic of this chapter.

In this chapter

Initial situation

The below image shows the initial situation with the data source assigned to the test case and the defined, but unbound variables next to the recording modules.

  1. Data source myCSVData with 8 data rows assigned to a test case.

  2. 6 unbound variables in 5 recording modules.

Access data binding


Use one of the following options:


Right-click a test container and click Data binding…


Double-click an unbound variable.

The data binding dialog

The data binding dialog opens with the following items:

  1. Data binding tab in the properties window of the test container

  2. List of available data columns from the assigned data source

  3. Multiple drop-down menus containing the defined variables available for binding

  4. Auto-bind function, explained at the end of this chapter

  5. Unbinds all variables from their data columns

Bind data to variables

Binding data to variables means specifying one variable per column.

For the column FirstName:

  1. Open the drop-down list of variables next to the data column.

  2. Check the variable to which the data will bound. In this case: InsertName.txtFirstName

Note Icon


Variable names in the data binding dialog are a combination of the module they are defined in and their actual name without the preceeding $. So for InsertName.txtFirstNameInsertName is the recording module, then there is a separating period, and txtFirstName is the actual variable name.

For the column LastName:

  1. Open the drop-down list of variables next to the data column.

  2. Check the variable to use for the data binding. In this case: InsertName.txtLastName

Note Icon


Only unbound variables are displayed. InsertName.txtFirstName is missing because we’ve already bound the column FirstName to it.

Repeat these steps for the remaining columns/variables.


  1. List of available data columns from the assigned data source.

  2. List of bound variables.

Resulting test suite view

  1. Data source myCSVData with 8 data rows assigned to a test case.

  2. 6 bound variables in 5 recording modules.

Our data-driven test is now complete. In the next chapter, we’ll run it and get our report.

View status in data binding pad

The data binding pad gives you a quick and detailed overview of a test container’s data binding, i.e. its variables and parameters, their status, and their values.

  1. To open the data binding pad, click the View data binding button in the toolbar and select a node (i.e. an item) in the test suite.

  1. The data binding pad displays the data binding information for this node.

  1. Data binding pad showing variables bound to a data source.

  2. Data binding pad showing variables bound to parameters.


This option automatically binds all variables to data source columns or to parameters of the exact same name.

Note Icon


Design your variables and data sources to be auto-bindable for quick data binding. An easy way to do so is to create your variables, and then Auto-create a simple data source in the Data-binding dialog.

Auto-bind is available in three places:

  • in the data-binding dialog (see further above)
  • in the data-binding pad
  • in a message displayed when adding/moving a module that has auto-bindable variables
Note Icon


When you auto-bind variables from the data-binding pad or the message and a variable fits both a data-source column and a parameter, then it is auto-bound to the parameter.

Auto-bind from data-binding pad

To auto-bind this way:

  1. Select an item with unbound, auto-bindable variables in the test suite.

  2. Click Auto-bind in the data-binding pad.

Note Icon


Select the test suite node and click Auto-bind to instantly bind all auto-bindable variables in the entire test suite!

Auto-bind from message

When you add or move a module that contains unbound auto-bindable variables, a message will pop up to ask you if you want to auto-bind these variables. You can also click Remember selection for this solution to always do so automatically.

Data binding in module groups

Data binding for module groups works a little differently than for test containers (test cases, smart folders).

Initially, variables used in recording modules that are inside a module group are not visible in the test suite view. You can only see them if you open the module group.

  1. Module group InsertName in the smart folder InsertData.

  2. The module group contains two recording modules, each with one defined but unbound variable.

  3. These variables are not yet visible in the test suite view and therefore can’t be used. At this point, they’re only visible inside the module group. They are encapsulated in it.

Bind the variables in the module group to data

To make these encapsulated variables visible in the test suite and bind them to data, we need to first bind them to module-group variables. These act as a bridge from inside the module group to the test container.

To bind variables to module-group variables:

  1. In the module group view, right-click the module group.

  2. Click Data Binding…

  1. Add a module-group variable for each recording-module variable and bind the recording-module variables to the module-group variables.


You can also bind the recording-module variables to constant values. This way, the variables will not be visible/usable in the test suite view, but still be bound to values.

Note Icon


Constant values do not appear in the report either. This is useful for binding variables to values that not everyone who reads the reports should be able to see.


  1. The variables are now visible through the module-group variables in the data binding pad…

  2. …and can be bound to data sources and parameters in test containers just like other variables.



Get the latest test automation information right in your mailbox.


© 2024 Ranorex GmbH. All Rights Reserved