Enabling stand-alone Standard Widget Toolkit applications

You must enable stand-alone Standard Widget Toolkit (SWT) support before using HCL OneTest™ UI to test SWT applications in the application under test.

About this task

To enable an SWT application, you must first enable the JRE in which the application runs, and then modify the Java code of the SWT application.

HCL OneTest UI automatically enables the environments for functional testing. As a result, you can directly record functional test scripts without enabling components manually. The automatic enablement takes place under certain conditions and has limitations. For more information about the conditions and limitations, see Automatically enabled environment for functional testing.

Procedure

  1. Enable the JRE in which the SWT application runs. To do this:
    1. Click Configure > Configure Applications for Testing from HCL OneTest UI to invoke the Enable Environments dialog box.
    2. Click the Java Environments tab.
    3. Click Search. The Search for Java Environments dialog box opens.
    4. Select the appropriate search mechanism, and click Search.

      When the search is complete, the JREs are listed in the Java Environments list.

    5. Select the environment of the SWT application by clicking it on the list.
    6. Click Enable and then click Close.
  2. Place the rational_ft_bootstrap.jar file in the classpath. The rational_ft_bootstrap.jar is found in the C:\Program Files\HCL\HCLOneTest\FunctionalTester\EclipseEnabler\plugins location.
  3. The enableSwtUi() method must be called from the User Interface (UI) thread of the SWT application. Add this code:
    try 
     { 
     com.rational.test.ft.bootstrap.Bootstrap.enableSwtUi(this); 
     } 
     catch (Throwable e) {}

    This must be called from the code that first creates the application shell.

  4. Save your changes.