Using Breakpoints

Applies to TestComplete 15.64, last modified on May 16, 2024

About Breakpoints

A breakpoint is a location in your script or keyword test where you want the script or test to pause during execution. Once execution is paused, you can check the state of the test, its output and its variables.

Breakpoints only function if the  Enable Debugging item of the Debug toolbar is checked. If this item is unchecked, the test execution will not pause using breakpoints.

Note: During distributed testing, TestComplete runs in silent mode on remote computers, and its debugger is turned off. Breakpoints in remote projects are ignored.

In the Breakpoints panel, you can view and manage breakpoints of the entire project suite. Each breakpoint can be enabled or disabled and made dependent on a condition - like a pass count or a conditional expression.

When a breakpoint is enabled with the optional condition set to true, and the script or keyword test execution reaches it (in a normal run or using the debugger), execution will stop just before the breakpoint line or operation (if you debug a keyword test). This line or operation will be highlighted in the Code Editor or Keyword Test editor. If a breakpoint is disabled, TestComplete does not stop the test execution.

In keyword tests, breakpoints can reside on any operation. However, in script code the breakpoints have to be on an executable script line, not a declaration, comment or blank line. Otherwise, the breakpoint is always disabled.

At any stop you can check the state of the tested application, the test output, variables, objects, their properties and so on. Using breakpoints is the easiest and most flexible way to preset spots in your tests where you want to run these types of checks.

To check the variable, parameter and property values, you can use the Watch List and Locals panels and the Evaluate dialog. See also Evaluating Expressions.

After the check is over, you can continue tracing the test using various debugger commands. See Debugging Tests - Overview for more information.

Setting Breakpoint

To set a breakpoint on a line of source code in the Code Editor:

  • Select the line in the Code Editor.

  • Click the left margin of the line.

    -- or --

    Press the Toggle breakpoint shortcut. (By default, F9. See Key Mapping for more information on how to change this shortcut).

Similarly, you can set a breakpoint on an operation in a keyword test:

  • Select the desired operation in the Keyword Test editor.

  • Click the indicator area to the left of the operation or press the Toggle breakpoint shortcut (by default, F9. See Key Mapping).

Note: You cannot set breakpoints on grouping nodes in the Keyword Test editor.

To set a breakpoint from the Call Stack panel:

  • Open the Call Stack panel that contains a sequence of script routine calls and keyword tests that led to the current execution point.
  • Right-click the desired routine or keyword test and select Insert Breakpoint from the context menu.

The breakpoint will be set on the script line or operation that follows the current execution point of the selected script routine or keyword test.

When you set a breakpoint, the script line or the operation of a keyword test is highlighted in red, and the mark appears in the left margin of the breakpoint line (or operation). Setting breakpoints is a toggle, so repeating the “set” on the same line will remove the breakpoint.

Yellow breakpoints indicate that they are set on script lines where TestComplete may or may not be able to pause the test execution (for example, comment lines).

Note: Sometimes, when you set a breakpoint, it appears with the hollow glyph instead of the solid glyph . This means that test debugging is disabled in TestComplete. To enable test debugging, select Debug > Enable Debugging from the TestComplete main menu.

While your test is running, you can switch to TestComplete just as you would switch to any Window’s application, and set a breakpoint. The new breakpoint will be set, and your script will pause when it reaches the breakpoint.

TestComplete also contains the Runner.Pause method that acts as a scripting analogue to breakpoints. A call to this method halts the test execution on the next script line as if this line has a breakpoint. Also, the script debugger is automatically activated if the Pause test execution on posting an error option is enabled. See Activating Debugger From Tests for more information.

Working With Breakpoints

To work with the list of all breakpoints for the current project suite, use the Breakpoints panel. This panel allows you to add, edit, delete, enable or disable breakpoints. You can also modify breakpoint properties using the Breakpoint Properties dialog. To call it, right-click the breakpoint icon in the Code Editor (or in the Keyword Test editor) and select Properties from the ensuing context menu. This menu also holds the Enabled item that controls whether the breakpoint is enabled or disabled. Disabled breakpoints are shown with the mark. Disabling breakpoints is useful if you want to deactivate the breakpoint temporarily.

About Conditional Breakpoints

Besides setting ordinary breakpoints, which pause test execution when the debugger reaches them, you can make breakpoints pause test execution only if certain conditions are met. This implies assigning either conditional expressions, or pass counts (however, using both on one breakpoint disables it). See Conditional Breakpoints. Conditional breakpoints are shown with the or mark. means the breakpoint is a disabled conditional breakpoint.

If you place the mouse cursor over the breakpoint mark ( , or ) the hint will display the breakpoint’s conditional expression or pass count.

See Also

Conditional Breakpoints
Stepping Through Test
Running to the Cursor
Setting Next Execution Point
Evaluate Dialog
About Watch List Panel
Call Stack Panel
Debugging Tests - Overview
Debugging Tests

Highlight search results