Activating Debugger From Tests

Applies to TestComplete 15.45, last modified on December 01, 2022

When executing a script or keyword test, the test engine automatically stops on breakpoints. The engine highlights the line or operation where it is stopped and activates the step-by-step execution mode. You can also create conditional breakpoints to stop the execution only if certain conditions are met. In some cases, it may be more convenient to activate the debugger from a script or keyword test. To do this, you can use the Pause test execution on posting an error option or the Runner.Pause method:

  • The Pause test execution on posting an error option resides in the Engines - General Options dialog. If this option is enabled, then TestComplete will activate the debugger whenever an error message is posted to the test log.

  • The Runner object contains the Pause method stops the test execution:

    To call the method from a keyword test, you can get use of the Run Code Snippet or Call Object Method operations.

    If you call a method from script, the execution stops on the line that will be executed after the line holding the method call’s instruction. If you call the method from a keyword test, the execution will be stopped on the operation that follows the Run Code Snippet or Call Object Method operation. In other words, the method works similar to a breakpoint.

During the pause you can evaluate code expressions and explore variable values in the Watch List and Locals panels or in the Evaluate dialog. You can then continue the test run or debug the code.

Note that both the option and the method work only if the  Enable Debugging toolbar item is checked. If the item is unchecked, the debugger is off.

The method does not perform any actions if the project is executed in TestExecute or if TestComplete was opened in Silent mode.

See Also

Debugging Tests
General Information

Highlight search results