When you test an application it might be necessary to run the same test with different input data. Within the following section you learn about:
According to the VIP Database application we can identify four variable input actions:
All these input actions are done within the AddVip recording. You need to open the recording file and identify the actions which have to be variable.

Specify the variable name and the default value, which is automatically set to the same value as it was recorded initially. If you want to alter the name or the default values simply open the variables dialog as described here.
Note: Please do not use variable names which are already in use by a recording or code module.
Repeat the previous step to create a variable 'LastName' for the key sequence action used to set the value of the last name field, too.
Within the recording 'AddVip' the variables 'FirstName' and 'LastName' are used for key sequence actions. To make a click action data driven - for example selecting the radio button Male or Female - you need to define a variable used for identification within a RanoreXPath expression.
Typically the radio button for the VIP Database application is identified by the controlname attribute. So the attribute controlname is checked by default. Because the test should use the text value as data driven input later on, you need to uncheck the control name attribute and check the text attribute as shown above. Now you can define a new variable for the attribute text by clicking the button on the right.
The same way you created a data driven click action on the radio button, you have to do it with the click action used to select a category item within the list box.
When looking at the repository you see that now two items are using the variables within the path expression specified before.
In addition rename the repository items to 'CategoryItem' and 'GenderOption' to clarify for what they can be used.
As you saw, the recording now uses four variables. In this section you will learn how to create a simple data table to provide the values for these variables. To create a new Ranorex data source you need to open the test suite view.
Select the test case which uses the 'AddVip' recording and open the Data Source dialog by clicking the 'Data Sources' button within the toolbar.
In order to combine your data table with the current test case - and finally with the AddVip recording which is used by the test case - you need to open the data binding dialog using the context menu as follows:
In additon to typical test data specified within data tables as shown before, a test suite and its test cases allow to declare global and local parameters. These parameters can be bound to module variables too. This type of data driven execution helps to specify for example environment related attributes as the following example describes.
The test case starts with a recording module called 'StartSystemUnderTest'. The recording only contains one single action item used to start the VIP Database application. Open the recording and create a new variabe called 'ApplicationPath'.
Specify a new parameter name by clicking in the first cell of the column 'Name'. Also specify a value for the new parameter. Just copy and paste the execution path from the default value shown within the variables dialog of the recording 'StartSystemUnderTest'. Read more about how to open a recording's variable dialog here: Recorder Variables
Click 'OK' to apply the changes and to close the dialog.
Now you are ready to combine the global parameter with the variable created within the recording before. Open the test case's data binding dialog the same way you did before for combining variables with the data table.
Before you execute the data driven test case you have to make sure that the values specified within the data table can be used correctly within the recording 'AddVip'. The values for the first name, last name and gender will not cause any problems during automation, but the values used for the category (Music, Movie, Sport, etc.) will be a problem because of the current visibility state of each item. Remember, you recorded a click on a visible list item within the list box category. When starting the VIP Database application you see that for example the category 'Sport' is not visible. Therefore you need to ensure visibility - using some lines of user code before you simulate the click action - or use a so called 'Invoke Action' to select a list item as shown below.
First, open the recording 'AddVip' and add a new 'Invoke Action' after the existing mouse click action used to select one of the category items.
Also delete the initial recorded mouse click action (action item #5 shown within picture above), because now the recording uses the new invoke action to select the list item.
Switch back to the test suite view and start your data driven test by clicking the 'Run' button.
Online User Guide
download as: PDF (20.3MB)
Ranorex Tutorial
(PDF file, 13.5MB)