Finally Operation

Applies to TestComplete 15.64, last modified on June 12, 2024


Use the Finally operation along with the Try and Catch operations to implement the structured exception handling mechanism in your keyword tests.

  • The Try operation groups operations that may cause an error.

  • The Catch operation contains operations that will be executed if an error occurs in the Try block.

  • The Finally block contains operations that will be executed regardless of whether an error occurs in the Try block. In other words, the Finally operation groups the operations that will perform clean-up actions. These operations can, for example, close some open files or connections, close a form of the tested application and so on.

The example of using the Try, Catch, and Finally operations

Click the image to enlarge it.


The Finally operation must be preceded by the related Try or Catch operations and must reside at the same level.

Operation Result

The operation does not return any value.

Scripting Analogue

The Finally operation is similar to the finally statement of C++, C# or Delphi.

Child Operations

The Finally operation can have any other operations as children.

For information on how to make an operation a child of another operation, see the description of the Keyword Test editor’s Test Steps page.

Operation Parameters

The operation does not have parameters.

See Also

Statements Category
Try Operation
Catch Operation

Highlight search results