GUI engines

Swing, JavaFX, SWT can be combined together in a single application not only by using top-level windows of different technologies but also by embedding components of one technology into windows of another. QF-Test supports testing such kinds of applications.

4+ Also web pages can be integrated into Java applications by use of embedded browsers, e.g. JavaFX's WebView component of JxBrowser. QF-Test provides support for a number of such hybrid combinations.

To that end, the concept of a GUI engine was introduced. One GUI engine is responsible for handling recording and replay for one GUI toolkit thread. Normal applications have only one such thread. As explained above, combinations of Swing, JavaFX and SWT are possible that have one thread each and will thus require two GUI engines to operate in parallel. In theory it is also possible to have multiple GUI engines of the same kind, e.g. by creating multiple instances of the SWT Display class.

Note The first GUI engine created for an SUT is called the default engine. It is used in all cases where no GUI engine is explicitly specified, most notably 'SUT script' nodes with an empty 'GUI engine' attribute.

Each QF-Test GUI engine is identified by a token for the GUI toolkit and a number. awt0, fx0 and swt0 are the primary GUI engine for AWT/Swing, JavaFX and SWT. Unless you have a very special application you will never need to concern yourself with the number of the engine, as there will never be an engine called awt1, fx1 or swt1 and the alias awt,fx or swt is sufficient. When recording, QF-Test always uses the latter.
NoteIf your application uses only the default engine, engine names can be left empty. Alternatively the token default can be used to explicitly address the default engine.

Typically engine identifiers are automatically set correctly during replay. Only when inserted by hand they need to be considered. In a test suite, engine identifiers are now stored in the following places.

  • 'Wait for client to connect' nodes. Only required if your application combines AWT/Swing, JavaFX and/or SWT. By specifying the engine attribute you can wait for the respective GUI engine to become initialized.
  • 'Window' nodes. The engine of a 'Window' node marks the window and all its child nodes as being either AWT/Swing, JavaFX or SWT. Embedded components of the other kind will be moved to a node for a pseudo window.
  • 'SUT script' nodes. An 'SUT script' is executed on the event dispatch thread of the SUT, so for combined AWT/Swing, JavaFX and/or SWT applications the engine is required to specify whether the script should be run on the AWT/Swing, JavaFX or the SWT thread. Thus, an 'SUT script' node can only retrieve and interact with components of one kind.
  • 'File selection' nodes. For Swing applications, the 'File selection' node is rarely used because the Swing JFileChooser is implemented in Java and can be fully controlled by QF-Test. The SWT FileDialog on the other hand is similar to the AWT FileChooser. Both are implemented natively and QF-Test has no control over the individual controls. Also the JavaFX FileChooser needs special handling. Thus file selection must be replayed using the 'File selection' node. Because this node is not explicitly associated with a 'Component' or 'Window' node, the engine has to be specified within the node.