Functions Added to All Scripting Languages

Applies to TestComplete 15.46, last modified on January 09, 2023

When creating scripts, you can use methods and properties of scripting objects as well as functions specific to the selected scripting language. Besides these methods, properties and functions, TestComplete provides a number of helper functions that do not belong to any object and that are available to all scripting languages.

Function Description
Chr Returns a character associated with the specified ASCII code.
InSet Checks whether a certain set contains the specified member.
MkSet Creates a set of the given members.

The code below creates a set of values using the MkSet function and then checks whether the created set contains the value 5 by using the InSet function.

JavaScript, JScript

function InSetExample()
{
  var Item0 = 0;
  var Item1 = 5;
  // ...
  var ItemN = 31;
  
  var MySet = MkSet(Item0, Item1, ItemN);
  
  if (InSet(5, MySet))
    Log.Message("The set contains the specified value.")
  else
    Log.Message("The set doesn't contain the specified value.");
  
}

Python

def InSetExample():

  Item0 = 0;
  Item1 = 5;
  # ...
  ItemN = 31;
   
  MySet = MkSet(Item0, Item1, ItemN);
   
  if (InSet(5, MySet)):
    Log.Message("The set contains the specified value.");
  else:
    Log.Message("The set doesn't contain the specified value.");

VBScript

Sub InSetExample

  Item0 = 0
  Item1 = 5
  ' ...
  ItemN = 31
  
  MySet = MkSet(Item0, Item1, ItemN)
  
  If InSet(5, MySet) Then
    Log.Message("The set contains the specified value.")
  Else
    Log.Message("The set doesn't contain the specified value.")
  End If 
  
End Sub

DelphiScript

function InSetExample();
var Item0, Item1, ItemN, MySet;
begin

  Item0 := 0;
  Item1 := 5;
  // ...
  ItemN := 31;
  
  MySet := MkSet(Item0, Item1, ItemN);
  
  if InSet(5, MySet) then
    Log.Message('The set contains the specified value.')
  else
    Log.Message('The set doesn''t contain the specified value.');
  
end;

C++Script, C#Script

function InSetExample()
{
  var Item0 = 0;
  var Item1 = 5;
  // ...
  var ItemN = 31;
  
  var MySet = MkSet(Item0, Item1, ItemN);
  
  if (InSet(5, MySet))
    Log["Message"]("The set contains the specified value.")
  else
    Log["Message"]("The set doesn't contain the specified value.");
  
}

See Also

About Script Tests

Highlight search results