Java

Rapise supports the testing of Java applications using a variety of different GUI toolkits including the Abstract Window Toolkit (AWT), Swing (Java Foundation Classes), and the Eclipse Standard Widget Toolkit (SWT). For maximum flexibility, Rapise can connect to your choice of JVM.

Java AWT Applications

Rapise supports the testing of Java applications using the Abstract Window Toolkit (AWT). The AWT was the first generation Java GUI library and was designed to allow Java applications to mimic the underlying operating system and map their controls into the native GUI environment (e.g. Win32).


Rapise supports the following Java AWT Controls:

Image Control Type Matcher Rule Record Learn Comment
File:JavaAWTLabel.gif Label JavaLabel No Yes
File:JavaAWTButton.gif Button JavaButton Yes Yes
File:JavaAWTTextField.gif Text Field JavaTextField Yes Yes
File:JavaAWTTextArea.gif Text Area JavaTextArea Yes Yes
File:JavaAWTCheckbox.gif Checkbox JavaTextBox Yes Yes
File:JavaAWTChoice.gif Choice JavaChoice No Yes
File:JavaAWTList.gif List JavaList Yes Yes
File:JavaAWTScrollBar.gif Scrollbar JavaObject No No
File:JavaAWTScrollPane.gif Scroll Pane JavaObject No No
File:JavaAWTPanel.gif Panel JavaObject No No
File:JavaAWTCanvas.gif Canvas JavaObject No No
File:JavaAWTMenuBar.gif Menu Bar JavaObject No No
File:JavaAWTPopupMenu.gif Popup Menu JavaObject No No
File:JavaBorder.gif Empty Border, Line Border, Matte Border, Titled Border, Etched Border, Bevel Border, Soft Bevel Border, Compound Border JavaObject No No

Java Swing Applications

Rapise supports the testing of Java applications using the Swing graphic library (formerly known as Java Foundation Classes). The Swing library was designed as a replacement for AWT that attempts to provide a consistent user interface for all Java applications regardless of the underlying Operating System GUI framework. As a result, Swing applications look the same on different platforms but do not generally match the design of native applications.


Rapise supports the following Java Swing Controls:

Image Control Type Matcher Rule Record Learn Comment
File:JavaSwingLabel.png Label JavaSwingLabel No Yes
File:JavaSwingButton.png Button JavaSwingButton Yes Yes
File:JavaSwingToggleButton.png Toggle Button JavaSwingToggleButton Yes Yes
File:JavaSwingCheckBox.png Check Box JavaSwingCheckBox Yes Yes
File:JavaSwingRadioButton.png Radio Button JavaSwingRadioButton Yes Yes
File:JavaSwingButtonGroup.png Button Group JavaObject No No
File:JavaSwingComboBox.png Combo Box JavaSwingComboBox No Yes
File:JavaSwingList.png List JavaSwingList Yes Yes
File:JavaSwingTextField.png Text Field JavaSwingTextField Yes Yes
File:JavaSwingTextArea.png Text Area JavaSwingTextArea Yes Yes
File:JavaSwingScrollBar.png Scroll Bar JavaObject No No
File:JavaSwingSlider.png Slider JavaSwingSlider No Yes
File:JavaSwingProgressBar.png Progress Bar JavaSwingProgressBar No Yes
File:JavaSwingFormattedField.png Formatted Field JavaObject No No
File:JavaSwingPasswordField.png Password Field JavaSwingPasswordField Yes Yes
File:JavaSwingSpinner.png Spinner JavaObject No No
File:JavaSwingSeparator.png Separator JavaObject No No
File:JavaSwingTextPane.png Text Pane JavaObject No No
File:JavaSwingEditorPane.png Editor Pane JavaObject No No
File:JavaSwingTree.png Tree JavaSwingTree Yes Yes
File:JavaSwingTable.png Table JavaSwingTable Yes Yes
File:JavaSwingMenuBar.png Menu Bar JavaSwingMenuBar Yes Yes
File:JavaSwingMenu.png Menu JavaSwingMenu Yes Yes
File:JavaSwingMenuItem.png Menu Item JavaSwingMenuItem Yes Yes
File:JavaSwingMenuItemCheckBox.png Menu Item / Check Box JavaSwingMenuItemCheckBox Yes Yes
File:JavaSwingMenuItemRadioButton.png Menu Item / Radio Button JavaSwingMenuItemRadioButton Yes Yes
File:JavaSwingPopupMenu.png Popup Menu JavaObject No No
File:JavaSwingPanel.png Panel JavaObject No No
File:JavaSwingTabbedPane.png Tabbed Pane JavaObject No No
File:JavaSwingSplitPane.png Split Pane JavaObject No No
File:JavaSwingScrollPane.png Pane JavaObject No No
File:JavaSwingToolBar.png Tool Bar JavaObject No No
File:JavaSwingDesktopPane.png Desktop Pane JavaObject No No
File:JavaSwingInternalFrame.png Internal Frame JavaObject No No
File:JavaSwingLayeredPane.png Layered Pane JavaObject No No
File:JavaSwingDialog.png Dialog JavaObject No No
File:JavaSwingFrame.png Frame JavaObject No No
File:JavaSwingColorChooser.png Color Chooser JavaObject No No
File:JavaSwingFileChooser.png File Chooser JavaObject No No
File:JavaSwingOptionPane.png Option Pane JavaObject No No

Java SWT Applications

The Java SWT GUI library is an alternative to Swing developed by the Eclipse foundation and it provides Java applications the ability to access the native GUI libraries of the operating system using JNI (Java Native Interface) in a manner that is similar to those programs written using operating system-specific APIs. Programs that call SWT are portable, but the implementation of the toolkit, despite part of it being written in Java, is unique for each platform.


Rapise supports the testing of applications written using Java Standard Widget Toolkit (SWT) using its UIAutomation library. Since SWT displays applications using native Windows controls it doesn’t need the Java Access Bridge to be installed (unlike Java AWT/Swing applications). The following SWT controls are recognized by Rapise:

Image Control Type Matcher Rule Record Learn Comment
button UIAButton Yes Yes
CheckBox UIACheckBox Yes Yes
ComboBox (simple) SWTComboBox Yes Yes
Editable ComboBox SWTComboBoxEdit Yes Yes
Button UIAHyperlink Yes Yes
Label UIALabel Yes Yes
List SWTList Yes Yes
File:UIAProgressBar.png Progress Bar UIAProgressBar No Yes
File:Win32RadioButton.png Radio Button UIARadioButton Yes Yes
File:Win32Slider.png Slider UIASlider Yes Yes
Tab Control UIATabControl Yes Yes
Edit Box UIATextBox Yes Yes
Tree SWTTree Yes Yes

Testing Java Applications with Rapise

Java Bridge Installation

In order to use a particular Java Virtual Machine (JVM) with Rapise you need to first install the Java Bridge into it. The installation process consists of several simple steps:

1. Click 'Java Support' link in the Rapise program group


2. Choose the target JVM in the list of available Java machines and press the [Install] button:

3. Verify that the installation is successful

Running the Java Sample

Rapise includes a Java sample. You can open it from the Start Page. Just choose the Java link in Browse Samples section located on the right side of the page.

The Java sample uses the JAVA_HOME environment variable to launch a simple Java application named AUTJAVA. Please make sure that the JAVA_HOME environment variable points to a JVM that has the Java Bridge installed (see previous section: Java Bridge Installation). If this is the first time you have set the JAVA_HOME environment variable then please reboot after adding it, otherwise the sample may not work.

How to Set JAVA_HOME in Windows

Please follow these instructions to set up the JAVA_HOME environment variable in your computer. First find out the installation folder of the Java development kit (JDK) or Java run-time environment (JRE) in your machine. Let's assume it is installed in the folder "C:\Program Files (x86)\Java\jre6".

  • Right click on the My Computer icon on your desktop and select properties
  • Click the Advanced Tab
  • Click the Environment Variables button
  • Under System Variable, click New
  • Enter the variable name as JAVA_HOME
  • Enter the variable value as the install path for the JDK or JRE
  • Click OK
  • Click Apply Changes

Troubleshooting

Windows Security

If you are testing Java on Windows Vista or Windows 7 and User Access Control (UAC) is turned ON then you should launch your Java application or Internet Explorer (if you start your Java application from a browser page) as Administrator.

JVM

If Rapise does not work with your Java application then the first thing to check is that JVM you use to launch the application is the same JVM where you installed the Java Bridge, if not either change the JVM or install the JavaBridge into the additional JVM.

Verify the JVM - Rapise Connection using Spy

You can use the Rapise Spy tool to verify the connection between the JVM and Rapise:

  • Launch your Java application
  • Launch Rapise, create new test, press Record button
  • In Application Chooser dialog choose your Java application
  • In Recording Activity dialog press Spy button
  • Verify that Spy window contains 'Java Object' label

Analyze Application

With Spy you can walk along the tree of Java objects in your application.


Save to File

You can save the Spy data for a particular node and all its descendants to a text file.



Reflection Information

You can save reflection information for a java class used to implement a GUI control.



Try Rapise free for 30 days, no credit cards, no contracts

Start My Free Trial

And if you have any questions, please email or call us at +1 (202) 558-6885