Thursday, April 7, 2011

QTP Debugging Options (Step Into,Step Out,Step Over)

Difference between step into (F11), step out (Shift+F11) and step over (F10) in QTP:

(The codes present in the snapshots are all available at the bottom, the snapshots are provided only for your better understanding)

To understand the difference between Step Into, Step Out and Step Over, create a new Test and associate one library which has function for addition of two numbers (as given below). Initiate a call to the function in libarary from test action as below and insert breakpoint at the line where call to the function is written.






Now let us get to the differences:

1) Step into
1. Run the test and it will pause on the function call and then press F11 i.e. step into it will run the single line statement and pause to the first line of function i.e. line 3.


2. After pressing F11 again line 3 of function gets executed and cursor pauses at line 4.
3. After pressing F11 again line 4 will get executed and result message will be displayed and pauses on line 6 i.e. “End Function”
4. Now, pressing F11 yet again will take you to the calling action and execute the next line which will be Wait(1) and pause there.
Conclusion:
Step Into is used for executing a single statement at a time, if that statement is a function call or action call then it will step into that function or action and called function or action will be displayed in QTP window and run pauses at the first line of the called function.

2) Step Out:
1. Run the test and it will pause on the function call and then press F11 i.e. step into it will run the single line statement and pause to the first line of function i.e. line 3.

2. After pressing Step Out (Shift+F11) all the remaining lines of function i.e. line 3 and line 4 get executed and cursor returns to test action next line after function call.


Conclusion:
Step Out is used for executing all the remaining statement in that function call or action from the position of cursor. Step out runs the local function entirely but if the function calls other function step out just pause to the first line called function.

Step Over:
1. Run the test and it will pause on the function call and then press F10 i.e. step over it will run called function entirely but does not displayed while running and cursor returns to Test action next line after function call


Conclusion:
Step Over is used for executing a single statement and if that statement is a function call or action call then it will execute the complete block of statements once present in the function/action and called function or action is not displayed in the QTP window.

18 comments:

  1. excellent way of explaning.... this clears the difference thank you.

    ReplyDelete
  2. superb....great explanation..Thanks a lot...

    ReplyDelete
  3. Good way to explain thanks

    ReplyDelete
  4. Awesome explanation yaar... Thank You sooooo much...

    ReplyDelete
  5. Great explanation..Thanks a lot.

    ReplyDelete
  6. thanks .. good explanation

    ReplyDelete
  7. Thanks a lot for the explanation..From many Days, I was not understanding the exact difference between these Runs.Today my doubt got cleared.

    ReplyDelete
  8. Nice Explanation... Thanks a lot... This clears my doubt...

    ReplyDelete
  9. good explanation which cleared my doubts

    ReplyDelete
  10. In my QTP 10.0 trail version debugging mode not working, plz help me anyone...
    Is there any Crack to Activate Kindly provide me that too... plz...
    Email : nagendra.eenadi@gmail.com

    ReplyDelete

Please leave your comment here...