ParamCount Property

Applies to TestComplete 15.0, last modified on October 21, 2021

Description

Use the ParamCount property to obtain the total number of parameters of the method that the given aqObjMethodObj object provides information about.

Declaration

aqObjMethodObj.ParamCount

Read-Only Property Integer
aqObjMethodObj An expression, variable or parameter that specifies a reference to an aqObjMethod object

Applies To

The property is applied to the following object:

Property Value

An integer value that specifies the total number of method parameters.

Example

The code below obtains the collection of all parameters that belong to the Click method of Notepad' s main window object. After that, the routine obtains the total number of the specified method's parameters and posts the parameter names to the test log.

JavaScript, JScript

function GettingMethodParameters()
{

  // Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var MethItem = aqObject.GetMethods(Obj).Item(1);
    
  // Obtains the number of the method's parameters
  Num = MethItem.ParamCount;
  
  for (var i = 0; i < Num; i++)
    // Posts the parameter name to the test log
    Log.Message( MethItem.ParamName(i) );
    
  // Closes notepad.exe
  Sys.Process("notepad").Terminate();
    
}

Python

def GettingMethodParameters():
  # Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL)
  # Specifies the object
  Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  # Obtains information about the Click method
  MethItem = aqObject.GetMethods(Obj).Item(1)
  # Obtains the number of the method's parameters
  Num = MethItem.ParamCount
  for i in range(0, Num):
    # Posts the parameter name to the test log
    Log.Message(MethItem.ParamName[i])
  # Closes notepad.exe
  Sys.Process("notepad").Terminate()

VBScript

Sub GettingMethodParameters

  ' Launches notepad.exe
  Call WshShell.Run("notepad.exe", SW_NORMAL)
  
  ' Specifies the object
  Set Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  
  ' Obtains information about the Click method
  Set MethItem = aqObject.GetMethods(Obj).Item(1)
    
  ' Obtains the number of the method's parameters
  Num = MethItem.ParamCount
  
  For i = 0 to Num-1
    ' Posts the parameter name to the test log
    Log.Message( MethItem.ParamName(i) )
  Next
    
  ' Closes notepad.exe
  Sys.Process("notepad").Terminate
    
End Sub

DelphiScript

function GettingMethodParameters;
var Obj, MethItem, Num, i;
begin

  // Launches notepad.exe
  WshShell.Run('notepad.exe', SW_NORMAL);
  
  // Specifies the object
  Obj := Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1);
  
  // Obtains information about the Click method
  MethItem := aqObject.GetMethods(Obj).Item(1);
    
  // Obtains the number of the method's parameters
  Num := MethItem.ParamCount;
  
  for i := 0 to Num-1 do
    // Posts the parameter name to the test log
    Log.Message( MethItem.ParamName[i] );
    
  // Closes notepad.exe
  Sys.Process('notepad').Terminate();
    
end;

C++Script, C#Script

function GettingMethodParameters()
{

  // Launches notepad.exe
  WshShell["Run"]("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var MethItem = aqObject["GetMethods"](Obj)["Item"](1);
    
  // Obtains the number of the method's parameters
  Num = MethItem["ParamCount"];
  
  for (var i = 0; i < Num; i++)
    // Posts the parameter name to the test log
    Log["Message"]( MethItem["ParamName"](i) );
    
  // Closes notepad.exe
  Sys["Process"]("notepad")["Terminate"]();
    
}

See Also

HasRetValue Method
Name Property
ParamName Property
ParamType Property
ValueType Property

Highlight search results