How to make global variables available to a Function Library w/o using "ExecuteFile"?
Having recently upgraded to from qtp 8.2 to 9.0, and seeking to make use of the capability to debug inside a function library, I was forced to to remove the "ExecuteFile" reference in the main script action that associated the Function Library file, and instead use the function library association established in the "resources" tab of Test Settings.
This created a problem where now functions in the function library that made use of global variables (dim'd and set in the main script action) do not work. A specific example I can offer is a logging function where the textstream object representing the logfile is set in the main test script, but writing to that file is performed by functions in the function library which make use of the logfile textstream object variable set in the main test script. Now when this is run, an "Object Required" error displays at the point in the logging function where it tries to write to the logfile using the textstream object variable, which indicates the logging function for some reason lacks access to global context variables.
How to fix this this issue while still retaining the ability to debug inside the function library?
OK, I got a solution to this. Originally, the statement...
... was in the main script body, which is supposed to give this variable global scope.
The solution to this issue was to move this "Dim" statement into the function library itself, but outside of any function. How or why this works, I do not understand. In any case, my testbeds will require significant restructuring to support this - I'm not sure yet if I'll bother.