Debugging Script Extensions

Applies to TestComplete 14.93, last modified on September 27, 2021

It is a good practice to detect and fix any errors in your script extension and make sure that the extension functions correctly before delivering it to end users. This topic explains how you can debug script extensions.

Preparing Extensions for Debugging

To debug your extension, you can do one of the following:

  • Copy the folder containing the extension files (scripts, description.xml, and others) to the <TestComplete>\Bin\Extensions\ScriptExtensions folder.

– or –

This is equivalent to installing the extension package (.tcx) in TestComplete—it will appear in the Script Extensions list and its actions and objects become available to TestComplete.

An important note before you proceed: Every time you make changes to your script extension (modify the script code, the description file or any other files), you must reload the extension in TestComplete for the changes to be applied. To reload the extension:

  1. Select File > Install Script Extensions from the TestComplete main menu.

  2. In the ensuing Script Extensions dialog, click Reload.

  3. Click OK to close the dialog.

Debugging Script Extensions

You can test your extension the same way you use other TestComplete features:

When testing your extension, you cannot use TestComplete debugging capabilities (breakpoints, stepping, watches, expression evaluation and other) because TestComplete locks the extension’s files while executing it. However, you can add your extension’s source script to a TestComplete project and debug it while running it directly from Code Editor.
  • To execute a record-time action, start recording, click on the Recording toolbar to expand it, click and select your action from the list of custom actions. Perform the operations needed to complete the action, then stop recording and check the results.

  • To execute a custom action, select it from the list of custom actions on the Tools toolbar. Follow the instructions to complete the action, and then check the results.

  • To debug a runtime object, write a script that uses the object’s properties and calls its methods, then run this test script and verify the results.

  • To debug a keyword test operation, create a keyword test containing this operation and, if needed, helper operations and specify the operation properties. Then run the test and check the results.

If you encounter an issue, you can add helper statements to the extension source code to find the cause of the problem. For example, you can use the aqDlg.ShowMessage or Log.Message method to display or log values of certain script variables.

Notes:

  • Make sure to reload your script extension in TestComplete after updating its source code.

  • Remove any debug code from the final version of the script.

You can also debug the source scripts of the extension directly in TestComplete, just like you debug ordinary test scripts. However, in this case, the Syntax and other script extension-specific objects will not be available, any reference to them will cause an error. For a full list of these objects, see Objects Available to Script Extensions. For information on working around this issue, see the Best Practices section of the Creating Script Extensions - Basic Concepts topic.

See Also

Script Extensions
Creating Script Extensions
Handling Errors in Script Extensions

Highlight search results