OnGenerate Event

Applies to TestComplete 14.80, last modified on April 13, 2021

Occurs when a new instance of the operation is created during test recording.

Declaration

OnGenerate(CodeDataParameters) Parameters
Code [in] Required String
Data [in] Required Object
Parameters [in] Optional Object

Description

The OnGenerate event occurs during test recording if the operation’s IsSupported event handler returned True for a particular piece of recorded script. In this case, TestComplete creates a new instance of the operation and then raises the OnGenerate event in order to initialize the operation parameters with values held in the recorded code.

A typical implementation of the OnGenerate event handler performs the following actions:

  1. Uses the Syntax.CurrentLanguage property to determine the scripting language currently in use.

  2. Parses the specified script code and retrieves values corresponding to the operation parameters. You can use regular expressions for this purpose.

  3. Initializes the operation parameters and internal fields with values retrieved from the script code.

Parameters

The event has the following parameters:

Code

A string containing a piece of recorded script code. The scripting language is the same as the one used in the user’s current project, and is determined by the Syntax.CurrentLanguage property.

Data

An object that provides access to the operation fields. This object contains properties that correspond to individual operation fields and whose names coincide with the field names.

Parameters

An object that provides access to the operation parameters. This object contains properties that correspond to individual operation parameters and whose names coincide with the parameter names.

Note for VBScript users: If the operation does not have parameters, this argument must be absent in the event handler’s arguments list.

See Also

Events Reference
IsSupported Event
OnCreate Event
CurrentLanguage Property
Creating Keyword Test Operations

Highlight search results