Java Add-in
This topic introduces UFT One's Java Add-in, used to test Java user-interface objects (controls), in environments such as Internet Explorer, Mozilla Firefox, Java Web Start, Applet Viewer, and in standalone Java applications.
Java Add-in support references
The Java Add-in provides customized Java test objects, methods, and properties that can be used when testing objects in Java applications.
For details, see the Java section of the UFT One Object Model Reference for GUI Testing.
Tip: If your controls are not supported out-of-the-box by UFT One, develop your own support. For details, see Java Add-in Extensibility.
For more details, see:
- Known Issues - Java Add-in
- The Java section of the UFT One Support Matrix
Java Add-in prerequisites
The following table lists prerequisites that may be required before using UFT One to test Java applications.
Opening Your Application |
If you cannot open your Java application after starting UFT, you may have a memory fragmentation issue. Check your memory settings |
Testing Java applets in a Web browser |
When testing Java applets in a Web browser, if your tests include operations on Web test objects, you must load the Web Add-in as well as the Java Add-in. In such cases, use the Web tab of the Record and Run Settings dialog box to specify your record and run preferences. |
Include all Java modules required by your application |
If your application requires Java modules that are not included by default, make sure that the command you use to run your application includes and opens the relevant modules. Include the following in the
|
Object identification in Java 16 or later (AWT, Swing and SWT) |
For UFT One to identify Java objects in Java 16 or later (using Oracle JDK, OpenJDK, or Zulu OpenJDK ), you must include and open the following modules and packages when you run your Java AWT, Swing or SWT applications:
You can specify these options in one of the following ways:
Note: For working with JavaFX applications see JavaFX applications instead. |
Java Add-in configuration
The following table describes where to find UFT One configuration options related to Java testing:
UFT One Options |
Use the Java pane. |
Record and Run Settings |
Use the Java tab. For details, see Java Tab (Record and Run Settings Dialog Box). |
Test Settings |
Use the Java pane. For details, see Java Pane (Test/Business Component Settings Dialog Box / Application Area - Additional Settings Pane). |
Custom Active Screen Capture Settings |
Use the Java section. For details, see Active Screen Pane (Options Dialog Box > GUI Testing Tab). |
Application Area Additional Settings |
Use the Java pane. For business components, the settings displayed in this pane are read-only. To change the Java pane settings for a business component, open its associated application area and use the application area's Additional Settings > Java pane. For details, see Java Pane (Test/Business Component Settings Dialog Box / Application Area - Additional Settings Pane). |
JavaFX applications
When working with JavaFX applications, we recommend using jre8_u60 or above. For details, see https://bugs.openjdk.java.net/browse/JDK-8086098.
In addition, depending on the Java version you are using, the following prerequisites apply:
Note: If you are working with Java 8 make sure that you have a minimum Java version of 8.0.1010.13.
Java 11 or later: For UFT One to identify Java objects, perform the following steps on the computer running your application:
-
Download the JavaFX module and store it locally.
Caution: Make sure the path in which you store the JavaFX module does not contain any spaces.
-
Set the following environment variable:
PATH_TO_FX =
<JavaFX module location>\lib
. -
Add %PATH_TO_FX% to your path.
You can do this separately or by adding this option when you run your JavaFX applications:
--module-path="%PATH_TO_FX%"
-
Include the following modules and packages when you run your JavaFX applications:
Note: The syntax displayed here for setting the module path applies to setting it in the
start javaw
command.Java 11 - 15:
--module-path="%PATH_TO_FX%" --add-modules=javafx.controls,javafx.fxml,javafx.base,javafx.swing,javafx.media --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-opens javafx.base/javafx.event=ALL-UNNAMED --add-opens javafx.graphics/javafx.stage=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene=ALL-UNNAME
Java 16 or later:
--module-path="%PATH_TO_FX%" --add-modules=javafx.controls,javafx.fxml,javafx.base,javafx.swing,javafx.media,java.desktop --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-opens javafx.base/javafx.event=ALL-UNNAMED --add-opens javafx.graphics/javafx.stage=ALL-UNNAMED --add-opens javafx.graphics/javafx.scene=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens javafx.controls/javafx.scene.control.cell=ALL-UNNAMED
You can specify these options in one of the following ways:
Command line |
Include the
|
Batch file |
Launch the application from a batch file instead of using a command line: In the folder containing your application's .jar file, create a .bat file containing the following command:
Example (Java 16 or later):
Save the .bat file and run it. |
Environment variable |
Enter the Note that this affects all Java applications that you run on this machine. Note: The syntax for setting the module path in an environment variable differs slightly from setting it in the Example (Java 16 or later): JDK_JAVA_OPTIONS = |
See also: