[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [qftestJUI] Question concerning QF-Test procedures and variable bindings.
Hi Mark, Thank you for the feedback with reference to my question concerning procedures and variable bindings. I feel the example I gave was not a good one, and I failed to put my question across clearly. Although your comments, regarding the script, and the use of rc.lookup, were indeed applicable to the poor example I provided in the attached test-suite file. Here is another attempt to try and clarify my question :- The following example has two procedures: Procedure 'proc1' which takes a parameter named 'timeout' Procedure 'proc2' which also takes a parameter named 'timeout' Procedure 'proc1' specifies a default value of '200' for the parameter 'timeout' Procedure 'proc2' specifies a default value of '300' for the parameter 'timeout' i.e. Procedure proc1( 'timeout' : default='200' ) call procedure proc2( $(timeout) ) End Procedure Procedure proc2( 'timeout': default='300' ) <server script - rc.lookup("timeout")> REM: doing an rc.lookup will result in an entry in the run log showing the value for the local variable binding 'timeout'. End Procedure Example test-suite file: (See attached file: example.qft) If procedure 'proc1' is called, and the caller provides the parameter 'timeout' (rather than an empty parameter list) i.e. call procedure proc1('timeout' : '100') then examination of the run log shows that the variable binding 'timeout' has the value '100', with reference to the rc.lookup in procedure 'proc2'. This is of course correct. (See attached file: 100.qrz) If on the other hand, the caller does not provide the 'timeout' parameter in their 'call procedure' node i.e. an empty parameter list., call Procedure proc1() then examination of the run log shows that the variable binding 'timeout' has the value '300', with reference to the rc.lookup in procedure 'proc2'. (See attached file: 300.qrz) I would have expected the value for 'timeout' to have been '200' (i.e. rc.lookup("timeout")), as this is the default value assigned to the local variable 'timeout' within the procedure 'proc1', and subsequently passed to procedure 'proc2'. Apologies if I am missing something simple here. Its probably something silly which is staring me in the face (may be its time for a holiday!). I thought the whole idea of being able to set a default value for the parameter to a procedure (like in C++), was to ensure that upon execution of that procedure, you could be certain that there was an initialised local variable binding (i.e. 'timeout' equal to '200; on the procedures stack frame), if the caller to that procedure (i.e. 'proc1') fails to provide anything but an empty parameter list in their 'call procedure' node. Any comments on the above from other would be welcomed. Thank you Regards Adrian