Dynamically Invoking Flex Methods

You can call methods, retrieve properties, and set properties on controls that Silk Test Workbench does not expose by using the dynamic invoke feature. This feature is useful for working with custom controls and for working with controls that Silk Test Workbench supports without customization.

Note: You can use dynamic invoke with scripts. Dynamic invoke is not available in visual tests.

Call dynamic methods on objects with the Invoke method. To retrieve a list of supported dynamic methods for a control, use the GetDynamicMethodList method.

Retrieve dynamic properties with the GetProperty method and set dynamic properties with the SetProperty method. To retrieve a list of supported dynamic properties for a control, use the GetPropertyList method.

Note: Typically, most properties are read-only and cannot be set.

Supported Methods and Properties

The following methods and properties can be called:
  • Methods and properties that Silk Test Workbench supports for the control.
  • All public methods that the Flex API defines
  • If the control is a custom control that is derived from a standard control, all methods and properties from the standard control can be called.

Supported Parameter Types

The following parameter types are supported:
  • All built-in Silk Test Workbench types

    Silk Test Workbench types includes primitive types (such as boolean, int, string), lists, and other types (such as Point)

Returned Values

The following values are returned for properties and methods that have a return value:
  • The correct value for all built-in Silk Test Workbench types. These types are listed in the Supported Parameter Types section.
  • All methods that have no return value return null in C# or Nothing in VB.

Examples

For example, when an application developer creates a custom calculator control that offers the following methods and the following property:
public function reset() : void
public function add(number1 : int, number2 : int) : int
public function get description : String
The tester can call the methods directly from his test. For example:
customControl.Invoke("reset")
Dim sum as Integer = customControl.Invoke("add", 1, 2)
Dim description As String = customControl.GetProperty("description")