33.2 The "Variable Bindings" Table

In the next step we add a procedure call in the second test case.

Procedure call to 'Check price'
Figure 33.5:  Procedure call to "checkFinalPrice" in the second procedure

Note If the procedure call already shows the price with its default value, this is because the procedure call was generated using the procedure itself, either by copying the procedure, via drag-and-drop using the procedure node, or by direct insertion of the procedure as explained further above. For the current topic we focus on the default value. Therefore, please delete any existing price parameter if you are following the tutorial step by step. To do so, click the red X above the "Variable bindings" table.

An error message indicates that a different price than the one displayed was expected. What went wrong? Let’s investigate the error. Usually we would look into the run log, but there is another important source of information.

In debugging mode you can see a list of nodes with variables bound by them at the bottom right of the QF-Test window.

Variable stack
Figure 33.6:  Variable definitions

The "Variable bindings" table is very helpful during debugging because it shows the current values of variables. It supports working with procedures and helps understand how QF-Test determines the correct variable value.

Note QF-Test processes the "Variable bindings" table from top to bottom.

You see that in the first lines no variables are bound. At the "Global variables" level one variable is bound, and on the secondary stack for "Procedure: checkFinalPrice" another one. The global variable is used for the connection to the SUT application and was set before application startup (cf. Starting and Connecting the Device). The other variable is of more interest right now — but it has the wrong value.

This value on the secondary stack is the default value, which is used when no variable with the same name is assigned a value elsewhere.

To fix this, we need to pass the correct value to the procedure in the procedure call. Again, there are several ways to do this. One way would be to add a new row in the "Variable bindings" table in the details of the procedure call, similar to how we did it in the procedure node in the previous section.

If there are already multiple procedure calls, the following is simpler:

In the procedure call, QF-Test creates a row in the "Variable bindings" table for each default value. In our case, a row has been added for the parameter named price with the value 13.349,00 €.

Even so, it will still not work in the second test case, even though the value is passed directly, because it is still the default value which is not correct here. Please do not change the value yet, so we can use the resulting error to demonstrate another debugging method.