Debugging an Action

Debugging an Action or a Function in QTP

Suppose you create an action or a function that defines variables that will be used in other parts of your test or function library. You can add breakpoints to the action or function to see how the value of the variables changes as the test or function library runs. To see how the test or function library handles the new value, you can also change the value of one of the variables during a break point.

This can be done by following below simple steps:

Step 1: Create a New Action or Function

Open a test and insert a new action, or open a new function library and create a new function called SetVariables.

If you are working in the Expert View, then follow Step 4 directly. If you are working in a function library, continue with Step 2 and Step 3.

Step 2: (For Function Libraries Only) Associate the Function Library with a Test

Make sure the function library is in focus. Select File > Associate Library ‘<Function Library Name>’ with ‘<Test Name>’. QuickTest associates the function library with your test.

Step 3: (For Function Libraries Only) Add a Call to the Function in Your Test

Add a call to the function by inserting a new step and typing the following in the Expert View: SetVariables.

Step 4: Add Breakpoints

Add breakpoints at the appropriate lines.

Step 5: Begin Running the Test

Run the test. The test or function library stops at the first breakpoint, before executing that step (line of script).

Step 6: Check the Value of the Variables in the Debug Viewer Pane

Step 7: Check the Value of the Variables at the Next Breakpoint

Click the Run button to continue running the test. The test stops at the next breakpoint.

Step 8: Modify the Value of a Variable Using the Variables Tab

Step 9: Modify the Value of a Variable Using the Command Tab

Step 10: Repeat a Command from the Command History

Rahnuma Tasnim

Leave a Comment

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

Scroll to Top