Supporting a Custom Control

Silk Test Workbench supports managing custom controls over the UI for the following technology domains:
  • Win32
  • Windows Presentation Foundation (WPF)
  • Windows Forms
  • Java AWT/Swing
  • Java SWT

To create a custom class for a custom control for which Silk Test Workbench does not offer any dedicated support.

  1. Click Tools > Manage Custom Controls. The Manage Custom Controls dialog box opens.
  2. In the .NET Script for Custom Controls field, type in a name or click Browse to select the script that will contain the custom control.
    The .NET script for custom controls is saved in the Common project. For all new databases, the default .NET script is called CustomControlScript. This script is automatically created for the user during the initial login to the database.
    Note: The .NET script is required. If no script is selected in the .NET Script for Custom Controls field, the OK button is disabled. Select a script to enable the button. For existing databases, if you have write access to the Common project and if there is no .NET script for custom controls set, Silk Test Workbench tries to save a new script in the Common project. If a script with the name CustomControlScript already exists, and you have write access to the Common project, Silk Test Workbench tries to save the script with a number appended to the end of the script name, by sequentially trying the names CustomControlScript2, CustomControlScript3, and so on.
  3. Click on the tab of the technology domain for which you want to create a new custom class.
  4. To automatically select the control, click Identify and the Silk Test Workbench switches to identify mode and you can select a control as usual. The Custom control class name and Silk Test base class fields are filled out in the current tab based on the identified control. Otherwise, continue with the Add steps below.
  5. Click Add. A new row is added to the list of custom controls.
  6. If you have chosen to manually add a custom control to the list:
    1. In the Silk Test base class column, select an existing base class from which your class will derive. This class should be the closest match to your type of custom control.
    2. In the Custom control class name column, enter the fully qualified class name of the class that is being mapped. For example: Infragistics.Win.UltraWinGrid.UltraGrid. You can use the wildcards ? and * in the class name.
    3. If you are working in Win32, click the check box in the next column if you want to change the way you refer to the class. If you turn off the check box, the name will default to the same as the Silk Test base class. The Silk Test class column is now enabled.
    4. In the Silk Test class column, click F2 and enter the name to use to refer to the class. This is what will be seen in locators. For example: //UltraGrid instead of //Control[13].
      Note: After you add a valid class, it will become available in the Silk Test base class list. You can then reuse it as a base class.
  7. Only for Win32 applications: In the Use class declaration column, set the value to False to simply map the name of a custom control class to the name of a standard Silk Test class. When you map the custom control class to the standard Silk Test class, you can use the functionality supported for the standard Silk Test class in your test. Set the value to True to additionally use the class declaration of the custom control class.
  8. Click OK.
  9. Only for scripts:
    1. Add custom methods and properties to your class for the custom control.
    2. Use the custom methods and properties of your new class in your script.
      Note: The custom methods and properties are not recorded.
Note: Do not rename the custom class or the base class in the script file. Changing the generated classes in the script might result in unexpected behavior. Use the script only to add properties and methods to your custom classes. Use the Manage Custom Controls dialog box to make any other changes to the custom classes.