Preparing Test Scripts to Run with SilkBean

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

When you are preparing test scripts to run with the SilkBean, keep the following tips in mind:
  • Do not use ~ActiveApp in window declarations that will be used with SilkBean. Either use a generic parent tag, such as [JavaMainWin]#1/ in the tag statement, or use a tag function if the parents can occur at different levels in the window hierarchy. For details see the multitag statement topic.
  • Note: In certain cases where dialog boxes are parented to other dialog boxes, the window hierarchy may differ between SilkBean and Windows. As for ~ActiveApp, use a tag function to compensate for the different levels of the parent windows.
  • Do not call Desktop.GetActive() in your scripts, since it is invalid for SilkBean.
  • The index tag of a MoveableWin, for example a main window or dialog box, may differ between SilkBean and the standard Java extension. The difference is not due to a difference in operating systems, like UNIX and Windows, but rather to a difference between the Java extension and SilkBean. For example, the Java extension may see the top visible window as "#1", but SilkBean may see the bottom-most window, which was the first one created, as "#1".
  • If you must use an index tag, then you can use a conditional expression in the tag to accommodate both the Java extension and SilkBean. The condition should be based on the value of the OPT_USE_SILKBEAN Agent option, which is TRUE if SilkBean is currently being used. For example, if the index for the Java extension is #1 and the index for SilkBean is #3, use:
    tag "#{Agent.GetOption (OPT_USE_SILKBEAN) ? "3" : "1"}"
  • Insert a right-mouse Click() before JavaAwtPopupMenu or JavaJFCPopupMenu in order to bring up the menu.

Additional considerations when testing AWT

  • If your application contains Abstract Windowing Toolkit (AWT) menus or AWT menu items, modify your declarations for these controls in a new test frame file as follows:
    If the AWT declaration is … Change the declaration to …
    Menu JavaAwtMenu
    MenuItem JavaAwtMenuItem
  • If you are testing AWT controls, do not use low-level methods to simulate mouse and keyboard events. Due to the limitations of platform-specific implementations of AWT controls, low-level events are not supported. Instead, use high-level methods when possible.

Java Foundation Class (JFC) controls support low-level events.