Tutorial Icon
QF-Test Tutorial Video Version

Tutorial as a video version, where we guide you step by step through QF-Test...

Selected Packages and Procedures

We will now have a closer look at a number of selected packages and procedures from the standard library.

We will start with packages for accessing components dependent on the UI technology they are implemented with, say JavaFX, Java Swing, Eclipse/SWT and Web components.

The Checkbox Packages

We begin by looking at the qfs.fx.checkboxqfs.swing.checkbox, qfs.swt.checkbox or qfs.web.checkbox package.

Some important procedures within this package are:

  • select Selects (checks) a checkbox. If the checkbox is already selected, then no action is taken.
  • deselect Deselects (un-checks) a checkbox. If the checkbox is already deselected, then no action is taken.
  • set Sets a checkbox to a given state (true or false).

For each of these procedures, you pass the QF-Test ID of a checkbox component as a variable argument. The library handles verification of whether or not the checkbox state was properly set as expected.

Usage of the other procedures in this package follows the general model seen here.

The Combobox/Combo Packages

The packages qfs.fx.combobox, qfs.swing.combobox, qfs.swt.combo or qfs.web.select contain procedures to select a value in a combobox.

Some procedures within this package are:

  • setValue Select a value in the list of the combobox.
  • getItemCount Return the number of entries in the select box.

The General Packages

The packages qfs.fx.general, qfs.swing.general, qfs.swt.general or qfs.web.general contain useful procedures to work with components.

Some procedures within this package are:

  • setLocation Set the location of a given component.
  • setSize Set the size of a given component.

The List Packages

The packages qfs.fx.list, qfs.swing.list, qfs.swt.list or qfs.web.list contain useful procedures to work with lists.

Some procedures within this package are:

  • getItemCount Return the number of items of the list.

The Menu Packages

The qfs.fx.menu, qfs.swing.menu, qfs.swt.menu or qfs.web.menu packages allow you to easily select items and checkbox items from menus or sub-menus. The procedures visible after expanding the package node are:

  • selectItem Selects an item from a menu.
  • selectSubItem Selects an item from a sub-menu.

For each of these procedures, you must pass the QF-Test ID of the menus as well as the item and/or sub-item to select or check; the usage varies slightly depending on the nature of the procedure.

The Table Packages

The packages qfs.fx.table, qfs.swing.table, qfs.swt.table and qfs.web.table provide utility procedures for tables, like:

  • getRowCount Return the number of rows of a table. It uses technology specific methods to gather the row number.
  • getColumnCount Return the number of columns of a table. It uses technology specific methods to gather the column number.
  • selectCell Select a given table-cell.

The Tree Packages

We've provided some simple access procedures for manipulating trees within the packages qfs.fx.tree, qfs.swing.tree, qfs.swt.tree and qfs.web.tree. These include:

  • collapseNode Collapse a node of a tree using separate parameters.
  • expandNode Expand a node of a tree using separate parameters.
  • selectNode Select a given tree node.

For any of these procedures, you simply pass the QF-Test ID of the node you wish to manipulate.

The Cleanup Packages

The packages qfs.fx.cleanup, qfs.swing.cleanup and qfs.swt.cleanup are useful for generic cleanup of the SUT environment after an unexpected exception occurs. Imagine, for example, that an exception is thrown while attempting to manipulate a menu in the SUT. The exception will cause the execution path within your test suite to be re-directed to an exception handler of a Catch node or of a dependency, or an "implicit" exception handler. This means that the normal flow of execution, which would have properly closed the open menu, has now been interrupted. Without proper action, that menu could be left open and thus block other events directed to the SUT.

Some important procedures within this package are:

  • closeAllModalDialogs Ensure that modal dialog windows of the SUT are closed. only available for Swing and FX!
  • closeAllDialogsAndModalShells Ensure that dialog and modal shells of the SUT are closed. only available for Eclipse/SWT!
  • closeAllMenus Close all menus of the SUT unconditionally.

The concept of implicit exception handling is an important one as an exception in a single test case is not meant to stop the whole test run. Just the current test case needs to be aborted and then continue with the next test case.

Therefore, an exception raised during the course of a Test case will be caught at that level and not propagated to prevent aborting the whole test run. The error state is duly noted in run log and report however.

If the Test case uses a Dependency the exception is passed to the Catch node of the same, if available. This kind of exception (and error) handling is described in the Dependency chapter of the manual.

The Run log Package

The qfs.run-log package contains procedures, which writes specified messages into the run log. This package has been introduced to give testers without scripting-knowledge the opportunity to write messages into the run log.

Here is the list of the most important procedures within this package:

  • logError Write a given error message into the run log.
  • logWarning Write a given warning message into the run log.
  • logMessage Write a given message into the run log.

The Run log.Screenshots Package

The qfs.run-log.screenshots package contains procedures, which write images into the run log and some helper methods.

Some important procedures within this package are:

  • getMonitorCount Return the total number of monitors.
  • logScreenshot Write a screenshot of the whole screen into the run log.
  • logImageOfComponent Write an image of a given component into the run log.
  • logScreenshotOfMonitor Write a screenshot of a given monitor into the run log.

The Shellutils Package

The qfs.shellutils package contains procedures to support most common shell-commands.

Some important procedures within this package are:

  • copy Copy a given file or directory to a specified target.
  • deleteFile Delete a given file.
  • exists Check for existence of a given file or directory.
  • getBasename Return only the file name of a full file name.
  • getParentdirectory Return only the directory name of the full file name.
  • mkdir Create a given directory. It also creates non-existing directories in path.
  • move Move a file of directory.
  • touch Create a specified file.
  • removeDirectory Remove a specified directory.

The Utils Package

The qfs.utils package contains procedures, which covers common helper-functionality during test-development.

Some important procedures within this package are:

  • getDate Return a string containing the date. Default is the current date. (Other dates can be configured.)
  • getTime Return a string containing the time. Default is the current time. (Other timestamps can be configured.)
  • logMemory Log current memory use.
  • printVariable Print the content of a given variable to the console.
  • printMessage Print a given message to the console.
  • writeMessageIntoFile Write a given string into a given file.

The Database Package

The qfs.database package contains procedures to execute SQL commands on a database.

Please note that the database driver must be in the class path, i.e. the respective jar file in the qftest plugin directory, before launching QF-Test.

To get more information about the connection-mechanism to your database, please ask your developers or see www.connectionstrings.com.

Some important procedures within this package are:

  • executeSelectStatement Execute a given SQL-Select-Statement. It stores the result in a global variable "resultRows" on the Jython variable stack and thus accessible from Jython scripts. Additionally, it stores the result in a group variable with the default name 'resultGroup', which can be accessed directy by QF-Test nodes.
  • executeStatement Execute a given SQL-command. Here any SQL command can be specified.

The Check Package

The qfs.check package contains procedures to do checks.

Some important procedures within this package are:

  • checkEnabledStatus Check, whether a component is enabled or disabled. It writes an error into the run log, if failing.
  • checkSelectedStatus Check, whether a component is selected or not. It writes an error into the run log, if failing.
  • checkText Check the text of a component. It writes an error into the run log, if failing.

The Databinder Package

The qfs.databinder package contains procedures for execution within a "Data driver" node which bind data for iteration.

Some important procedures within this package are:

  • bindList Create and register a databinder that binds a list of values to a variable. Variables are separated by whitespace or by a given separator character.
  • bindSets Create and register a databinder that binds a list of value-sets to a set of variables. Value-sets are separated by line breaks. Variables within a value-set are separated by whitespace or by a given separator character.