IsSupported Event

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

Occurs during test recording to check whether a particular piece of recorded script is equivalent to the operation.

Declaration

IsSupported(Code) Parameters
Code [in] Required String
Result     Boolean  

Description

Custom keyword test operations created with script extensions can be recorded just like standard operations. To enable this, the operation developer needs to implement the IsSupported and OnGenerate event handlers.

TestComplete records tests as script code and then converts this code to the appropriate keyword test operations. The IsSupported event occurs when TestComplete checks if a particular piece of recorded script can be replaced by the given operation. The event handler should parse the specified code and return True if it matches operation and False otherwise.

If the IsSupported event handler returned True for a particular code snippet, the OnGenerate event is then raised to generate an operation instance corresponding to that code.

A typical implementation of the IsSupported routine performs the following actions:

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

  2. Checks if the Code string matches the operation’s scripting equivalent in the appropriate language. You could perform such a check using regular expressions.

Parameters

The event has one parameter:

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.

Return Value

True, if the specified script code is equivalent to the operation; otherwise False.

Remarks

If the IsSupported event handlers of several operations return True for the same code snippet, TestComplete records the operation that has higher priority. By default, standard operations of the Checkpoints category have the highest priority.

Be careful when implementing the IsSupported event handler. Returning True for unmatching code snippets may break the keyword test recording.

See Also

Events Reference
OnGenerate Event
CurrentLanguage Property
Creating Keyword Test Operations

Highlight search results