Data binding | Ranorex Studio User Guide
Help CenterUser GuideRanorex Studio advanced

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

    tipp icon

    Screencast

    The screencast “Data binding” walks you through information found in this chapter.:

    Watch the screencast now

    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.

    Initial situation for variable binding

    Data source myCSVData with 8 data rows assigned to a test case.
    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.

    Accessing data binding

    The data binding dialog

    The data binding dialog opens with the following items:

    Data binding dialog

    Data binding tab in the properties window of the test container

    List of available data columns from the assigned data source

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

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

    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:

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

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

    Note icon

    Note

    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.txtFirstName, InsertName is the recording module, then there is a separating period, and txtFirstName is the actual variable name.

    Binding variables - part I

    For the column LastName:

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

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

    Note icon

    Note

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

    Binding variables - part II

    Repeat these steps for the remaining columns/variables.

    Result

    Finished variable binding

    List of available data columns from the assigned data source.
    List of bound variables.

    Resulting test suite view

    Resulting test suite view with bound variables

    Data source myCSVData with 8 data rows assigned to a test case.
    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.

    Auto-bind

    This option automatically binds all data columns (i.e. column headers) of a data source to variables with the exact same name. If you keep this in mind while designing your data source and naming your variables, you can accelerate the data-binding process.

    Auto-bind function