background image
<< Focusing on a part of the application | Recording a class for the Drawing Area >>

Identifing custom controls

<< Focusing on a part of the application | Recording a class for the Drawing Area >>
8
Working with Java Applications
Step 3: Identifing custom controls in the Drawing Area window
SilkTest provides 4Test class definitions for commonly used Java objects, such as Abstract Window
Toolkit (AWT) controls. For more information, see Abstract Window ToolKit in the online Help. With our
Java support, you will be able to use 4Test methods and properties to test Java objects that belong to
these predefined classes, which can be found in javaex.inc. For more information about predefined
classes see the Predefined class definition file in the online Help.
Java support also allows you to test custom controls, which appear as CustomWin objects in Java
applications. You will need to record classes for custom controls to gain access to their native methods
and properties. You can then use these native methods and properties to develop scripts for testing
custom Java objects in the application.
Let's identify the custom controls we want to test in the Drawing area window.
At this point, we assume you have started the sample Java application, and become familiar with the
Drawing area window.
To identify custom controls in the sample Java application:
1 Select Control/Drawing area in the Java application. The Drawing Area window opens.
2 In SilkTest, select Record/Window Declarations.
3 Move the mouse pointer inside the Event Log (the scrollable white rectangular area). SilkTest
sees the Event Log as a JavaAwtTextField object, a predefined AWT control.
4 Move the mouse pointer over the Reset button, then over the Exit button. SilkTest sees these
buttons as JavaAwtPushButton objects, predefined AWT controls.
5 Move the mouse pointer inside the drawing canvas (the gray rectangular area). SilkTest sees the
drawing canvas as a CustomWin object, a custom Java control.
6 Click Close to close the Record Window Declarations dialog.

We have determined that the drawing canvas is a custom Java control. Since we will use this custom
control in our test, we need to record a class for the drawing canvas; continue to Step 4: Recording a
class for the Drawing Area canvas.