Watch List Panel - Common Tasks

Applies to TestComplete 14.40, last modified on April 22, 2021

The Watch List panel allows you to create and manage watch expressions you want to track during the debugging.

Adding Watch Expressions

Right-click somewhere within the Watch List panel and select New Item from the context menu. In the resulting Watch Properties dialog, specify the expression and its display format.

If you debug a script routine, you can also add a watch expression directly from the Code Editor in one of the following ways:

  • Use context menu

    1. Move the insertion point to the desired expression in the Code Editor or select the expression in the Code Editor.

    2. Right-click the selection and choose Debug > Add Watch from the context menu.

  • Drag the desired expression

    1. Select the needed expression in the Code Editor.

    2. Drag the selected expression from the Code Editor to the Watch List panel.

TestComplete will add the expression to the Watch List panel. You can then modify the expression as needed.

Typically, watch expressions contain a variable or parameter, whose value you would like to trace. If you debug a script routine, you can specify the variable (or parameter) name. If you debug a keyword test, then to specify the test’s variable, use the following syntax:

KeywordTests.KeywordTestName.Variables.VariableName

For instance:

KeywordTests.KeywordTest1.Variables.Var1

Besides the variables’ and parameters’ names, the watch expression may contain any other script code.

Note for DelphiScript users: The ExceptionMessage function cannot be evaluated.
Enabling and Disabling Expressions

You may want to keep a watch expression available, but not calculate it. To do this, you can disable the expression:

  • Clear the expression’s check box in the Expression column.

– or –

  • Double-click the expression, and clear the Enabled check box in the resulting Watch Properties dialog.

The expression will be grayed out, and no value for it will be displayed.

Disabling unneeded expressions can save time during the test run as the debugger will not have to provide values of elements that may require complex system calls.

Modifying Watch Expression

Right-click the desired watch expression in the Watch List panel and choose Edit from the context menu. This will call the Watch Properties dialog, in which you can edit the expression and its display format.

Assigning New Values to Variables or Array Items
  1. Specify the desired variable or array item in the Expression column.

  2. Select the Value column and press F2, or click the Value cell twice (not a double-click). This will activate the in-place editor.

  3. Specify a new value in the in-place editor and press Enter to confirm the input. Esc will cancel the change.

Important notes:

  • The script expression may contain constants, local variables, objects, properties, function calls as well as arithmetic and logical operators. TestComplete will execute the specified expression and assign it to the variable.

  • If you use a string value, enclose it in quotes (JavaScript, JScript, Python, VBScript, C#Script and C++Script) or apostrophes (DelphiScript).

  • The specified value should be a valid script expression and it must match the syntax of your project’s scripting language.

  • To explore and change the values of some object parameters, you can select Inspect from the context menu of the desired object and assign new values to the parameters in the ensuing Inspect dialog.

  • Currently, you cannot assign a new value to local variables in JavaScript.

For information on modifying variables’ values during debugging, see Changing Variables During Debugging.

Deleting Watch Expressions
  1. Select the desired watch expression(s) in the Watch List panel (you can use Ctrl- or Shift-click for multiselection. To select all expressions, you can also choose the Select All item of the panel’s context menu).

  2. Press Del or right-click the selected expression and choose Delete from the context menu.

Copying Values of Watch Expressions

Right-click the desired watch expression in the Watch List panel and choose Copy from the context menu.

See Also

Evaluating Expressions
Changing Variables During Debugging

Highlight search results