Search code examples
vbscripthp-uft

Printing VBScript variables in QTP UFT


How can I check values of my variables at run time when using QTP UFT? I simply want to create a variable, do logic and fill it with data, set a breakpoint in the line following the variable and then check or output its value somewhere.

I have tried:

print variableName
WScript.Echo variableName

The first produces error: Print function type mismatch
The second produces error: Object required: "WScript"

I'm not sure where the problem lies as I've just started to get into both UFT and VBScript (mostly did C# and javascript and everything is quite different here). Could someone tell me the correct solution and perhaps also explain these errors to me?


Solution

  • If you wanted to see all variables use the debug viewer in QTP.

    View -> Debug Viewer

    There you can list all the variables you want to watch. You should be able to see them in break points.

    Note : Ensure you have Windows script debugger installed to use the debug viewer.