Tutorial Icon
QF-Test Tutorial Video Version

Tutorial as a video version, where we guide you step by step through QF-Test...

The Variable Bindings table

The next step is to make use of the procedure call in the second test case as well.

  • ActionReplace the 'Check text' node of the second test case by a procedure call to checkFinalPrice. You can simply copy the respective node from the first test case or add the procedure call as learned in the previous chapter.
Second procedure calls 'Check price'
Figure 15.5:  Second procedure calls 'checkFinalPrice'

Note If you added the procedure call by a copy or drag and drop operation from the procedure itself you will find the price in the Variable definitions table of the procedure call. This is what we are eventually aiming at. However, at this stage we want to explain the default value. So, if you want to follow the tutorial exactly, please delete the default value by pressing the red X above the table.

An error message shows up indicating different values for the price expected and the price got. What went wrong? Let's go hunting. Typically we use the run log for this but there is another view worth to know of.

  • Action So click OK to close the error message.

In debugging mode you will find an additional bottom right section of the QF-Test window showing a list of nodes with variables bound to those nodes.

  • Action You might want to resize the variable bindings table in case it is too small to see all its content.
Variable stack
Figure 15.6:  Variable bindings

The variable bindings table is very useful for debugging. It comes in quite handy, too, when working with procedures and trying to understand the way QF-Test figures out which variable value to use. It shows the current values of the variables.

Note QF-Test always checks the variable bindings table from top to bottom.

You can see that the first rows of the table have no bindings at all. Then there is a binding at the level 'Globals' and another one in the fallback stack for the procedure 'checkFinalPrice'. The global variable is used for the client connection, which has been set when starting the application (cf Starting the Browser). The other variable is more interesting to us - only it has the wrong value.

The default value is intended to be used for the parameter if no value has been defined elsewhere. This is why we added the parameter to the 'Parameter default values' table of the procedure node.

To do things correctly we need to pass the proper value when calling the procedure. Again, there are several ways to do it. One is to add a new row to the variable definitions table of the 'Call procedure' nodes similarly to the way you did at the 'Procedure' node in the last section.

If the procedure is called multiple times within the test suite, there is a better way:

  • ActionStop the current test execution clicking the toolbar button Stop.
  • Right-click the 'Procedure' node and select »Additional node operations«-»Update parameters of references« from the popup menu.
    Popup menu
    Figure 15.7:  Popup menu for 'Additional node operations'
  • In the following dialog, please check the tick mark for »Add missing parameters to callers« is set and click OK.

In the 'Call procedure' nodes QF-Test adds a row each for every default parameter to the variable definition table of the procedure call . It also copies the default value of each default parameter. In our case it is the parameter price with the value 30,049.00 €.

You might notice that the numerical value of the price variable is still wrong in the second case, regardless of whether it is defined implicitly as a default value or explicitly via a parameter. For now we want to keep that error to show you additional means of debugging.

  • ActionClose the 'Updated nodes' dialog QF-Test opened to inform you about the updated nodes.