Debugging Tests

Debugging Tests
Debugging is a process of executing the script or a program in a User designed fashion with some temporary break points in order to identify the errors.
For debugging, QTP is providing debug commands and breakpoints.
Debug Commands:
1)  Step Into (short cut key F11):
  1. It starts execution
  2. It executes one statement at a time.
  3. If it is function call, it opens the function, after that it executes one statement at a time.
2) Step Over (Short cut key F10):
a) It executes one statement at a time after execution starts
b) It executes all functions statements at a time
Note: After opening the function, if we use step over it executes one statement at a time only.
3)  Step Out (shift +F11):
It executes all remaining statements in a function at a time.
Ex: Dim a,b,c
a=100
b=200
c=a+b
msgbox c
msgbox “hello”
Call hyderabad
msgbox “bye bye”
Note: Create a script and work on it
Break Point:
This feature is used for breaking the execution temporarily.
Navigation:
Place cursor in desired location >Debug menu>Insert/Remove break point
Or
Use short cut key (F9)
Or
Place mouse pointer before the statement and click.
Note: If we want to execute Some part of the Test Script at a time and some other part of the test script step by step, there we can use breakpoints.
Debug viewer Pane:
It is used for viewing, modifying or setting the value of the variables during the execution break with the help of 3 Tabs.
    1. Watch
    2. Variables
    3. Command
Note: Through Debug Viewer Pane, We can watch variables whether the variables are taking correct values or not at a specific point of time. We can change Values of Variables temporarily.
Ex :
Dim x,y,z
x=10
y=20
z=x+y
msgbox z
msgbox “Hello”
x=35
y=67
z=x*y
msgbox z
msgbox “bye bye”
Navigation: View menu > Debug Viewer > Use step into feature.

 

Comments