Data binding | Ranorex

Data binding

After the declaring variables and preparing test data it is necessary to bind variables to data items to make use of data-driven testing. This section shows how to bind variables to test data items.

In this chapter

    Initial situation

    The below image shows the initial situation with the test container (smart folder, test case) assigned to test data and declared, but unbound variables in test modules.

    Initial situation for variable binding

    Initial situation for variable binding

    Test data myCSVData with 8 data rows assigned to a test case
    List with 6 unbound variables in 5 recording modules

    Accessing data binding

    Accessing data binding

    Accessing data binding

    Select the test container (smart folder, test case) and open the context menu
    Click Data binding…

    Alternatives:

    Double-click an unbound variable in the test suite view

    Data binding dialog

    The data binding dialog opens. It is simply structured and contains a few control items.

    Data binding dialog

    Data binding dialog

    Data binding register tab of property window
    List with available data colums of assigned test data set
    List with module variables (if bound), empty if unbound
    Auto-bind function, explained at the end of this chapter
    Clear bindings button, unbounds all module variables from their data colums

    Binding variables to data

    The binding of variables to data is done on a variable-to-data-column basis.

    Binding variables - part I

    Binding variables – part I

    Binding data column FirstName to its module variable

    Action(s):

    Open the drop-down list of module variables in the line of the data column
    Select the module variable which is to be linked to the data column with mouse-click

    Binding variables - part II

    Binding variables – part II

    Binding data column LastName to its module variable

    Action(s):

    Open the drop-down list of module variables in the line of the data column
    Select the module variable which is to be linked to the data column with mouse-click

    tipp icon

    Hint

    Module variables which already have been bound to a data column are not available for data binding of further data columns.

    Result

    Finished variable binding

    Finished variable binding

    List of available data columns of assigned test data set
    List with bound module variables

    Resulting test suite view:

    Resulting test suite view with bound variables

    Resulting test suite view with bound variables

    Test data myCSVData with 8 data rows assigned to a test case
    List with 6 bound variables in 5 recording modules

    Auto-bind function

    The data-binding function implements a very helpful auto-bind functionality. This option enables to automatically bind variables to data items based on the requirement, that data items (columns headers) are named equal to their corresponding module variables.

    Auto-bind function

    Auto-bind function