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:

Back to top

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, and see Memory issues.

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.

Back to top

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.
(Make sure that a GUI test is open and select Tools > Options > GUI Testing tab > Java node.)

Record and Run Settings

Use the Java tab.
(Record > Record and Run Settings)

For details, see Java Tab (Record and Run Settings Dialog Box).

Test Settings

Use the Java pane.
(File > Settings > Java node)

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.
(Tools > Options > GUI Testing tab > Active Screen node > Custom Level)

For details, see Active Screen Pane (Options Dialog Box > GUI Testing Tab).

Application Area Additional Settings

Use the Java pane.
In the application area, select Additional Settings > Java in the sidebar.

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).

Back to top

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:

Java 8 Make sure that you have a minimum Java version of 8.0.1010.13.

Java 11

To use UFT One with JavaFX applications in Java 11, perform the following steps on the computer running your application:

  1. 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.

  2. Set the following environment variables.

    • PATH_TO_FX = <JavaFX module location>\lib.

    • In PATH, add %PATH_TO_FX%.

    • JDK_JAVA_OPTIONS = --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-UNNAMED

Java 12 or later

To use UFT One with JavaFX applications in Java 12 or later, perform the following steps on the computer running your application:

  1. 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.

  2. Set the following environment variables.

    • PATH_TO_FX = <JavaFX module location>\lib.

    • In PATH, add %PATH_TO_FX%.

  3. We recommend not running a command line window and your application at the same time. Therefore, launch the application from a batch file instead of using a command line that specifies the module path and dependencies:

    In the folder containing your application's .jar file, create a .bat file containing the following command: 

    start javaw --module-path="%PATH_TO_FX%" --add-modules={all modules required by your application} --add-opens {specify opens for modules if required} -jar <Application_Name>.jar

    Example:

    start javaw --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-UNNAMED -jar JavaFX.jar

    Save the .bat file and run it.

Back to top

See also: