Creating Custom Group Operations

Applies to TestComplete 15.31, last modified on March 17, 2022

This topic explains specifics of creating custom group operations for your keyword tests.

About Group Operations

Group operations are keyword-test operations that group child operations. A group operation can perform some actions that will affect child operations included in the group.

Child operations of a group operation are always executed. If you need to run child operations according to a certain condition or in a loop, create a conditional or loop keyword-test operation.

Creating Custom Group Operations

Creating conditional operations is similar to creating any other keyword test operation. You need to do the following:

  • Declare the operation and define its parameters in the description.xml file.

  • Implement script code that will handle the operation’s events and implement the operation’s functionality.

For information on creating custom keyword-test operations, see topics of the Creating Keyword Test Operations section. This topic explains specifics of creating custom group operations.

Declaring Group Operations

  • You declare group operations in the same way in which you declare other custom keyword-test operations. You can find an example below. For detailed information on elements and attributes, see Structure of the Description File.

  • Important: in order for the test engine to recognize your operation as a group operation, the OperationType attribute of the KDTOperation element must be equal to Group. You also need to specify handlers for events that will implement the operation’s functionality (see below for information on these events):

    XML

    [File: description.xml]
     

    <?xml version="1.0" encoding="UTF-8"?>
    <ScriptExtensionGroup>

      <Category Name="My Custom Keyword Test Operations">

        <ScriptExtension Name="My Group Operation" Author="John Smith" Version="1.0" HomePage="someURL.com">
          <Script Name="myUnit.js">
            <KDTOperation Name="My Group" Category="Standard" Icon="la-icon.bmp" OperationType="Group">
              <Data>
                ...
              </Data>
              <Events>
                <Event Name="OnExecute" Routine="MyOp_OnExecute"/>
                <Event Name="OnCreate" Routine="MyOp_OnCreate"/>
                <Event Name="OnSetup" Routine="MyOp_OnSetup"/>
              </Events>
              <Columns>
                ...
              </Columns>
            </KDTOperation>
          </Script>
          <Description>
            ...
          </Description>
        </ScriptExtension>

      </Category>
    </ScriptExtensionGroup>

  • Like any other keyword-test operation, custom group operations can have parameters and fields. For information on defining parameters and fields, see Creating Operation Parameters and Fields.

Events to Be Implemented

The functionality of custom keyword-test operations is implemented by script event handlers that are called at specific points of time. Some of the events are triggered during the test run, and their event handlers implement the operation's behavior. Some other events occur at design time, and their event handlers let users configure the operation’s parameters.

There are no events that group operations must implement. Below is a description of some events that you may find useful:

  • OnExecute - Occurs when the test engine executes your group operation. This event occurs before executing child operations. Write an event handler for it to perform specific actions that are common for all child operations.

  • OnCreate - This event is triggered only once, when your operation is added to a keyword test. Write an event handler for it to perform initialization actions for the operation. See Creating Operation Initialization Routine.

  • OnSetup - This event is triggered every time when a user modifies your operation’s properties. This happens, for instance, when the user adds the operation to their test, or the user double-clicks the operation in the Keyword Test editor to modify the operation’s properties. See Creating the Operation Setup Routine.

  • You can also create script routines that handle column editing events: StartEditing, GetEditValue, SetEditValue, and ApplyChanges. See Implementing In-Place Editing Support.

See Also

Creating Conditional, Loop and Group Operations
Creating Keyword Test Operations
Creating Keyword Test Operations - Basic Concepts

Highlight search results