Debugging Components and Function Libraries in QTP


In QTP, after you create a component or function library including registered user functions, you should check that they run smoothly, without errors in syntax or logic. To debug a function library, you must first associate it with a component via its application area and then debug it from that component.

To detect and isolate defects in a component or function library, you can control the run session using the Pause command as well as various step commands that enable you to step into, over, and out of a specific step.

You can use the Start from Step command to begin your debug session at a specific point in your component. You can also use the Run to Step command to pause the run at a specific point in your component. You can set breakpoints, and then enable and disable them as you debug different parts of your component or function library.

When the component or function library run stops at a breakpoint, you can use the Debug Viewer to check and modify the values of VBScript objects and variables. Also, if QTP displays a run error message during a run session, you can click the Debug button on the error message to suspend the run and debug the component or function library.

You can also use the Run from Step command to run your component or function library from a selected step to the end. This enables you to check a specific section of your application or to confirm that a certain part of your component or function library runs smoothly.

Important things to remember:
  • While the component and function libraries are running in debug mode, they are read-only. You can modify the content after you stop the debug session. If needed, you can enable the function library for editing (File > Enable Editing) after you stop the session.  After you implement your changes, you can continue debugging your component and function libraries.
  • If you perform a file operation, the debug session is stopped.
  • In QTP, when you open a component, QTP creates a local copy of the external resources that are saved to your Quality Center project. So, any changes you apply to any external resource that is saved in your Quality Center project, such as a function library, will not be implemented in the component until the component is closed and reopened.
Please note, an external resource is any resource that was not created using QTP, such as, a function library created in an external editor.

No comments:

Post a Comment