ArgListCall Keyword


Equivalent to a function or method call.


Ret=ArgListCall (sName, argList)
Variable Description
Ret The return value of the function or method called.
sName The name of the function or method to be called. STRING.
argList The list of arguments that the function or method takes. LIST.


  • You can use ArgListCall to call a function or method by specifying the function or method name and its arguments as arguments to ArgListCall. This allows you to define fully data-driven tests, where you can pass in the names of the functions and methods you want to be called.

  • ArgListCall (sName,argList) is equivalent to sName (argList). For example:
    • ArgListCall ("Min", {1,2}) is equivalent to Min (1,2)

    • myWin.ArgListCall ("GetChildren", {}) is equivalent to myWin.GetChildren ( )

  • As with standard method calls, you can use the operator to specify a class to act upon. For example:

    AnyWin::ArgListCall ("GetChildren", {}) is equivalent to AnyWin::GetChildren ( )

Example 1

ArgListCall is most useful when you have data-driven tests and want to pass the name of the methods and/or functions to call in particular runs of the tests.

The following example uses one test to compare two numbers. You can pass in the function to use to compare the numbers at runtime:

[-] testcase NumCompare (STRING sFunc, LIST argList) appstate none
	[ ] INTEGER iRes
	[ ] iRes = ArgListCall (sFunc,argList) 
	[ ] Print ("{sFunc}: {iRes}") 
	[ ] 
	[ ] // Results:
	[ ] // Testcase NumCompare ("min", {3, 4}) - Passed
	[ ] // min: 3
 [ ] // Testcase NumCompare ("max", {3, 4}) - Passed
 [ ] // max: 4

Example 2

Assume you have a test for a text field. Instead of hard coding the name of the method to call, such as:
myTextField.SetMultiText ("1", "2", "3")
you would like to generalize the test so that you can pass in the name of the method. Use ArgListCall.

Instead of directly calling SetMultiText in the test, specify the following:

myTextField.ArgListCall (sName, myList)
Now you can set the name of the method and its arguments externally to the test and pass them in at runtime. To call SetMultiText with the arguments shown above, define the following:
STRING sName = "SetMultiText"
LIST myList = {"1", "2", "3"}
and reference sName, myList in the test. You can either define sName and myList as global variables and use them directly in a test or define the test as a data-driven test that takes arguments and pass the values as arguments to the test, such as:
[-] testcase SampleTest (STRING sName, LIST myList)
	[ ] ...
	[ ] myTextField.ArgListCall (sName, myList)