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 for, here Web.

The Checkbox Package

We begin by looking at the 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 Select Package

The package qfs.web.select contains 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 Package

The package qfs.web.general contains 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 Table Package

The package qfs.web.table provides 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 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.