TestComplete 6 Sneak Peek - Support for Java Controls

TestComplete 6 is currently under development, the information contained in this article is not final and may change at any time.

TestComplete can work with all types of UI controls by simulating mouse clicks and keystrokes. However, ordinary clicks and keystrokes are often not enough for working with controls and you may also need to perform specific actions, for example, selecting a combo box item, checking a check box, and so on.

TestComplete already provides comprehensive support for Win32 and WPF controls so that you can perform various operations over them. TestComplete 6, the new version now in beta testing, will include special program objects that let you work with 20 of the most popular Java controls:

  • JButton
  • JCheckBox and JToggleButton
  • JComboBox
  • JList and classes inherited from it
  • JMenuBar and classes inherited from it
  • JPasswordField
  • JRadioButton
  • JScrollBar
  • JScrollPane
  • JSlider
  • JSpinner
  • JTabbedPane
  • JTable
  • JTextArea, JTextPane and JEditorPane
  • JTextField and JFormattedTextField
  • JTree

(Of course, the list may be expanded in future versions of TestComplete)

TestComplete 6’s support for Java controls is very similar to the Win32 and WPF controls support. TestComplete automatically associates specific program objects with Java controls. Each of these program objects contain the methods and properties of the underlying control as well as a number of specific properties and methods added by TestComplete for the control. Using these specific methods and properties, you can, for instance, select items in combo boxes, check and uncheck check boxes, and so on.

Below, you will see how TestComplete 6 supports Java controls, through an example of the TestComplete’s sample Orders application:

First we recorded a script that modifies the order data using the edit form. Here is the sequence of the actions we used in the recording:

  • Right-click the “Samuel Clemens” item.
  • Select “Edit order” from the context menu.
  • In the resulting dialog, select “FamilyAlbum” from the “Product” combo box.
  • Click the up buttons of the “Quantity” spin box twice.
  • Select the “VISA” radio button.
  • Enter “123412341234” in the “Card Nr” text box.
  • Click the OK button.

We recorded a script using TestComplete 5 and then using TestComplete 6, so you can compare these scripts. Note that TestComplete can only work Java applications’ controls if the Java Open Applications and Java Controls Support plug-ins are installed and enabled. So, before you proceed make sure that these plug-ins are installed and enabled.

The script recorded by TestComplete 5 looks like:

As you can see, actions over the form controls were recorded as coordinate clicks. Without comments or any additional information, it is hard to understand what the script does. The log produced by this script contains a lot of “The windows was clicked with the NNN mouse button” messages and also isn’t much help for analyzing the script run:

Click to display image

Below are the same actions recorded by TestComplete 6:

This script is more readable. You can see that the actions performed over Java controls were recorded specific to the controls: right-click on a table cell is recorded as the ClickCellR action, popup menu selection is recorded as the SwingPopupMenu.Click action, selection of a combo box item is recorded as a ClickItem action, and so on. With TestComplete 6, it is easier to understand what the script does.

The log produced by this script is also more informative. It signifies the exact actions performed over controls and how the controls’ state was changed:

Click to display image

TestComplete 6’s support for Java controls is extremely useful for those who test Java applications. The new version will help you record and write readable, efficient and stable test code. For a complete list of changes made to TestComplete, see What’s New in TestComplete 6.



Close

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox