Thursday, September 18, 2008

QTP Debug Viewer Pane

1. Create a script like this below:

2. Make sure that the cursor is at line 4, go to Debug-> Insert/Remove Breakpoint or press F9.

3. Run the test. At run time the test will pause at the breakpoint. Make sure Debug Viewer pane is open (or open it right now), View->Debug Viewer.


4. Go to variable tab in the Debug Viewer pane. It will show variable “a” and its value.

[During a run session, the Variables tab displays the current value of all variables that have been recognized up to the last step performed in the run session.]

5. Select “a” in the test and choose Debug-> Add to Watch. You will see the Watch tab automatically opens in the debug viewer with the name of the variable added along with its current value.

[The Watch tab enables you to view the current value of any variable or VBScript expression that you added to the Watch tab.]

6.Click on Run again to further proceed with the test, each time it will stop at the breakpoint and you have to click Run or press F5. While the test is running, you will see the Watch tab updating the value of “a”.

7. Run the test completely.

Now let’s see what the Command tab does.


Run the test again. When you see the below message box, just click OK and go to the Command tab in the debug viewer.

In the debug viewer type a=4 and press Enter key on the keyboard (like below).

Again press F5 or click Run.

It will straightaway show message box a=4 like below

The Watch and Variable tabs are also updated accordingly. So now the test continues from 4 as the value of “a” and leave the values 1, 2 and 3 which it would have shown earlier had we not used the Command tab.

[Use the Command tab to execute a line of script to set or modify the current value of a variable or VBScript object in your function library. When the run continues, QuickTest uses the value that you set.]