Recording Classes for Ignored Java Objects

This functionality is supported only if you are using the Classic Agent.

Silk Test Classic ignores certain objects during recording that normally should remain transparent to users, such as panels and containers. Typically these classes don’t have a graphical component, or are used solely to aid the placement of objects. However, there may be cases in which these ignored classes have been extended and contain objects that you want to test. In some situations, custom objects, such as user-defined objects or third-party JavaBeans, might be inadvertently ignored.

Using our Java support in Silk Test Classic, you can expose these ignored objects, then record classes for them in Java applications and in Java applets.

To record classes for ignored Java objects:
  1. Start your Java application and make sure Java support is enabled.
  2. Create a new include (.inc) file, open an existing include file, or open the test frame file for storing your new class definitions. We recommend that you store your new class definitions in a new include file, for example custobj.inc, or in your test frame file. Do not store these definitions in javaex.inc, the predefined Java class definition file, because we will upgrade javaex.inc in future versions of our Java support.
  3. Click Record > Class and then check the Show all classes check box in the lower left corner of the dialog box.
  4. To include native methods with return or parameter types that do not match valid 4Test methods, check the Show all methods check box in the lower left corner of the dialog box. You cannot call these methods directly from your 4Test scripts but you can use the InvokeMethods or the InvokeJava method to call them. When you capture the class, Silk Test Classic displays these methods prefaced by comments in the Record Class dialog box. When you click Paste to Editor, Silk Test Classic adds the InvokeMethods method and these methods, prefaced by comments, to your test script.
  5. Position the mouse pointer over the control for which you want to record a class, and when the correct name displays in the Window field, press Ctrl+Alt. Methods and properties for that class are displayed in the Record Class dialog box. If you have checked Show All Methods, Silk Test Classic displays these non-4Test methods as comments, that is, prefaced by forward slashes (//).
  6. Click the Derived From list box to see the list of available 4Test classes.
    • If there is a class type in the list that maps directly to your object, choose it.
    • If not, choose AnyWin, which is a generic class. See winclass declaration and derived class for more details.
    Note: Note the Tag for the class you just recorded; you will need this name later.
  7. Click Paste to Editor to paste the new class into the include file.
  8. Uncheck the Show all classes check box in the Record Class dialog box, and the Show all methods check box, if you chose it for this record action, and then click Close. It is very important to check Show all classes only while you are trying to record the class for an ignored Java object.
  9. Open javaex.ini, located in the extend subdirectory of the directory where you installed Silk Test Classic.
  10. In javaex.ini, create a section called [ClassList] and add a line that reads <class tag name>=true. For example, if the tag of the class you just recorded is [com.mycompany.Spinner], add this line:
    com.mycompany.Spinner=true
    Note: The name can contain wildcards, which can be useful for exposing all classes in a package, for example:
    com.mycompany.module_classes_to_expose.*\=true
  11. Save and close javaex.ini. When you uninstall Silk Test Classic, the file javaex.ini is backed up as javaex.bak in the <Silk Test install directory>\extend folder. Any changes you made to javaex.ini can be reinstated by copying them from javaex.bak and pasting them into the new javaex.ini that is created when you reinstall Silk Test Classic.
  12. Restart the Agent and your application.
  13. Load the include file that contains the new class definitions.