Example of Step Into
1. Write a function as below in a new test. Create a breakpoint as shown in the 8th line. (Make sure that the cursor is at line 8, go to Debug-> Insert/Remove Breakpoint or press F9.)
2. Also create a library1 as shown below and associate it (from the File menu) with the test we created above. Note that the function in the library (test_func1) is being called by the function in the test (test_func).
3. Make sure both test and library are open and we are in the test at present (not in the library) and run the test.
The test will stop at line 8, the first function call.
4. Press F11 or Choose Debug > Step Into. The line 8 gets executed and the cursor will go to second line.
5. Again press F11. It will execute the line 2 and show you the message box.
When you click OK in the message box above the cursor goes to the line 3.
6. Again press F11. It executes the line 3 and takes you to the first line of the called function in the library.
Now read what Step Into is exactly and you will never forget it.
[Step Into is used to run only the current line of the active component or function library. If the current line of the active component or function library calls a function, the called function is displayed in the QuickTest window, and the function library pauses at the first line of the called function.(as in step 6 above)]
Example of Step Out
1. Again make sure that both test and function library are open and currently we are in the test which has a breakpoint at line 8.
2. Run the test. It will pause at line 8.
3. Press F11. It will go to the second line.
4. Now press SHIFT+F11 OR Choose Debug > Step Out. It will execute the second line and third line.
When it will execute the third line, it goes to the test_func1 and pauses at the second line of the test_func1 as shown below.
5. Let’s comment the line which calls test_func1 from the test.
6. Rerun the steps as above. It will show all the three message boxes and Pauses at line 9, second function call.
Now read what Step Out is? Use Step Out only after using Step Into to enter an action or a user-defined function. Step Out runs to the end of the called action or user-defined function, then returns to the calling test or function library and pauses the run session.
Step Out runs the local function in its entirety but if that local function calls some other function from it, Step Out just goes to the first line of that function and pauses there..
Example of Step Over
1. Again make sure that both test and function library are open and currently we are in the test which has a breakpoint at line 8. Also comment out the line 2 in test as shown below.
2. Run the test.
3. When the test pauses at line 8 press F11. It goes to line 3 as shown below.
4. Now press F10 or Choose Debug > Step Over. It will run test_func1 and show you all the three message boxes, but it will stay at test only and does not show you the library while running it. After running, it pauses at line 4 of test.
Above if we had pressed Shift + F11 (Step Out) it would just have gone to the first line of test_func1 and would have paused there.
[Use Step Over to run only the current step in the active test or function library. When the current step calls another action or a user-defined function, the called action or function is executed in its entirety, but the called action or function script is not displayed in the QuickTest window.]