Testing a Custom Control Using Dynamic Invoke

Silk Test Classic provides record and playback support for custom controls using dynamic invoke to interact with the custom control during replay. Use this low-effort approach when you want to access properties and methods of the custom control in the test application that Silk Test Classic does not expose. The developer of the custom control can also add methods and properties to the custom control specifically for making the control easier to test.

To test a custom control using dynamic invoke:

  1. To retrieve a list of supported dynamic methods for a control, use the GetDynamicMethodList method.
  2. Call dynamic methods on objects with the DynamicInvoke method.
  3. Call multiple dynamic methods on objects with the DynamicInvokeMethods method.
  4. To retrieve a list of supported dynamic properties for a control, use the GetPropertyList method.
  5. Retrieve dynamic properties with the GetProperty method and set dynamic properties with the SetProperty method.

Example

This example tests a spinner custom control that includes two buttons and a text box, as shown in the following graphic.

Custom control example

The user can click Down to decrement the value that is displayed in the text box and click Up to increment the value in the text box.

The custom control offers a public CurrentValue property that can be set and retrieved. The value in this example is 3.

To set the spinner's value to 4, type the following:
WINDOW spinner = Desktop.Find("//FlexBox[@className=customcontrols.Spinner]")
spinner.SetProperty("CurrentValue", 4)