Different types of Breakpoints in QTP?

By settings a breakpoint, QTP can stop a run session at a pre determined place in a test or component, A breakpoint is indicated by a red hand icon in the left margin of the keyword view, or a red circle in the left margin of the Expert view, Quick Test pauses the run when it reaches the breakpoint, before executing the step, User can examine the effects of the run up to the breakpoint, make necessary changes, and then continue running the test or component from the breakpoint.

Breakpoints in QTP

Breakpoint is used to:

Stop the run session temporary and can have a look about the script and application

Marking for which step, Break point is Needed(Ex.Loop)

To set a breakpoint

Click a step or a line in to the test or component where want the run to stop.

Choose Debug menu->insert->/Remove Breakpoint, Press F9, or click the Insert/Remove Breakpoint button, symbol is displayed in the left margin of the keyword view and Expert View

Different Types of Breakpoints in QTP

Step into:

Choose Debug->Step into, Click on step Into button or Press F11 to run only the current line of the active test or component, suppose current line of the active test or component calls another or a function, then called action or function is displayed in the quick test window.

Step out:

Choose Debug->Step Out or use step out button, or press SHIFT+F11 only after using Step Into to enter a action or a user defined function .

Step over:

Choose Debug->Step over link or click step over button, or press F10 to run only the current step in the active test or component, when the current step calls another action or a user-defined function, the called action or function is executed in it’s entirely, but the called action script Is not displayed in the Quick test window.

To create the sample test:

Choose File->New to open new test

Click on expert view tab in Quick test to display the expert view

Enter the following line exactly

Public function myfunc()

Msgbox “one”

Msgbox “two”

Msgbox “three”

End function

My func

My func

My func

To run the test using step into, step out, and step over commands

Press F9 button in keyboard (insert/Remove Breakpoint) to add a breakpoint on the seventh line of the test (the first call to the myfunc function), the Expert view breakpoint symbol is displayed in the left margin.

Run the test, the test pauses at the breakpoint

Press F11 (Step into), the execution arrow points to the first line with in the function (msgbox “one”)

Press F11 (Step into) again, A message box displays the text one.

Click OK button to close the message box, The execution arrow moves to the next line in the function.

Continue pressing F11 (Step into) until the execution arrow leaves the function and is pointing to the eighth line in the script

Press F11 (Step into) to enter the function again, the execution arrow will point to the first msgbox line within the function

Press SHIFT+F11 (Step out), three message box will  open, then execution arrow continues to point to the first line in function until the last of the three message boxes are closed, After the third message box is closed the execution arrow points to the last line in the test

Press F10 (Step Over) all three message boxes open again, the execution arrow remains on the last line in the test.

Debug Viewer Pane:

Debug Viewer Pane, is mainly used in debugging the test, the debug viewer pane contains the Watch Expressions, command tabs  and Variables (The debug Viewer pane is not displayed When Quick Test opens up for the first time, to view the toolbar select from the menu view->Debug Viewer

Leave a Reply

Your email address will not be published. Required fields are marked *