Data driver

The term Data-driven Testing refers to a common method in automated testing where test cases are executed several times with different sets of data defined. With QF-Test's highly flexible variables there is no limit on how this data can be used but the most common case is for event input values and expected check values.

QF-Test's data-driving mechanism consists of the 'Data driver' node used to provide a data-driving context and several kinds of 'Data binders'. Currently available are the 'Data table' node that stores data internally within QF-Test the 'CSV data file' node that reads data from a CSV file, the 'Database' node that reads data from a database and the 'Excel data file' that reads data from an Excel file. An extension API for plugging in arbitrary external data is also available.

Further information about how the various parts of the data driver mechanism are working together is provided in chapter 22.

'Data driver'

Except for its special place in a 'Test set' or 'Test step', a 'Data driver' is just like a normal 'Sequence'. It provides a context for one or more 'Data binders' to register themselves during the execution of the 'Data driver'. The 'Test set' then iterates over the sets of data provided by the registered 'Data binders' and executes its child nodes as described in chapter 22. For this purpose a 'Data driver' node needs to be placed in a 'Test set' node, between the optional 'Dependency' and 'Setup' nodes. 'Data driver' nodes can also be placed in a 'Test step' as first steps.

Contained in:'Test set', 'Test step'.

Children: Any

Execution: When a 'Test set' or 'Test step' is executed it checks for a 'Data driver' and runs it. The contents of the 'Data driver' node are not limited to 'Data binders', but can hold any executable node so that they can perform any setup that may be required to retrieve the data. Thus it is also possible to share 'Data binders' by placing them inside a 'Procedure' and calling the 'Procedure' from inside the 'Data driver'. Any 'Data binders' registered within this 'Data driver's' context will then be queried for data by the 'Test set' or 'Test step'.

Attributes:

'Data driver' attributes
Figure 41.14:  'Data driver' attributes
'Name'

The name of a 'Data driver' is a kind of short description. It is displayed in the tree view, so it should be concise and say something about the kind of data provided.

Variable: No

Restrictions: None

'Name for loop pass in the run log'

A separate name for each iteration to be used in the run log. It can make use of the variables bound as a result of the data-driving which makes it easier to locate a specific step of the iteration.

Variable: Yes

Restrictions: None

'Name for separate run log'

If this attribute is set it marks the node as a breaking point for split run logs and defines the filename for the partial log. Every time an iteration of the 'Data driver' finishes, the respective log entry is removed from the main run log and saved as a separate, partial run log. This operation is completely transparent, the main run log retains references to the partial logs and is fully controllable. Please see subsection 7.1.6 for further information about split run logs.

This attribute has no effect if the option Create split run logs is disabled or split run logs are explicitly turned off for batch mode via the -splitlog command line argument.

There is no need to keep the filename unique. If necessary, QF-Test appends a number to the filename to avoid collisions. The filename may contain directories and, similar to specifying the name of a run log in batch mode on the command line, the following placeholders can be used after a '%' or a '+' character:

CharacterReplacement
%Literal '%' character.
+Literal '+' character.
iThe current runid as specified with -runid <ID>.
rThe error level of the partial log.
wThe number of warnings in the partial log.
eThe number of errors in the partial log.
xThe number of exceptions in the partial log.
tThe thread index to which the partial log belongs (for tests run with parallel threads).
yThe current year (2 digits).
YThe current year (4 digits).
MThe current month (2 digits).
dThe current day (2 digits).
hThe current hour (2 digits).
mThe current minute (2 digits).
sThe current second (2 digits).
Table 41.5:  Placeholders for the 'Name for separate run log' attribute

Variable: Yes

Restrictions: None, characters that are illegal for a filename will be replaced with '_'.

'Variable definitions'

This is where you define the values of the variables that remain bound during the execution of the sequence's child nodes (see chapter 6). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

'Data table'

A 'Data table' provides a convenient interface for storing test data in tabular form directly inside QF-Test. For details about the data-driving mechanism please see chapter 22.

Contained in: Any

Children: None

Execution: The 'Data table' expands variable values in the table according to the option When binding variables, expand values immediately. Each row is expanded individually left to right, meaning that - within the same row - a cell may refer to a variable bound in a column further to the left. Then the 'Data table' registers itself with the 'Data driver' context. A property group called like the node will be created additionally. That group contains the variables size and totalsize. size shows the number of data rows with taking care about iteration intervals. The variable totalsize shows the total number of data rows without taking care about iteration intervals. When all 'Data binders' have been registered the 'Test set' will query the 'Data table' in order to iterate over the available sets of data. If no such context is available the respective property group will be extended with all variables.

Attributes:

'Data table' attributes
Figure 41.15:  'Data table' attributes
'Name'

The 'Name' of a 'Data binder' is mandatory. It is used to distinguish 'Data binders' in the same 'Data driver' context. A 'Break' node executed during data-driven testing can be used to break out of a specific loop by referring to the 'Data binder's' 'Name'.

Variable: Yes

Restrictions: None

'Iteration counter'

The name of the variable that the iteration counter will be bound to.

Variable: Yes

Restrictions: None

'Iteration ranges'

An optional set of indexes or ranges to use from the bound data. This is especially useful during test development in order to run sample tests with just a single index or a subset of the given data.

Ranges are separated by ','. Each range is either a single index or an inclusive range of the form 'from-to' or 'from:to' where 'to' is optional. Indexes or ranges may be specified multiple times, overlap or be given in descending order. Indexes are 0-based, negative indexes are counted from the end, -1 being the last item. An invalid syntax or an index outside the valid data range will cause a BadRangeException.

The following table shows some example range specifications and the resulting indexes, based on a set of 20 entries.

Iteration rangesResulting indexes
0[0]
-2, -1[18, 19]
1-2,4:5[1, 2, 4, 5]
18:,-3-[18, 19, 17, 18, 19]
3-2,16:15[3, 2, 16, 15]
Table 41.6:  Iteration range examples

Note The value bound for the 'Iteration counter' reflects the index in the current interval, not the counter of actual iterations, e.g. if you specify '2' there will be a single iteration with the 'Iteration counter' bound to '2', not '0'.

Variable: Yes

Restrictions: Valid syntax and index values

'Data bindings'

This is where the actual test data is defined. Each column of the table represents one variable with its name specified in the column header. Each row is a set of data, one value per variable. Thus the number of rows determines the number of iterations of the data-driven loop. To start entering the data you first need to add columns to the table to define the variables, then add rows to fill in the values. See also subsection 2.2.5 about how to work with the table.

Variable: Yes, even the column headers

Restrictions: None

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

'Database'

A 'Database' node is used to load external data from a database. To access the database it is required to have the jar file with the database driver in QF-Test's class path. Usually, this means to put it into the qftest plugin-directory (section 49.2). For more information about the connection mechanism to your database ask the developers or see www.connectionstrings.com.

For further details about the data-driving mechanism please see chapter 22.

Contained in: Any

Children: None

Execution: The 'Database' loads the data from the database and expands variable values according to the option When binding variables, expand values immediately. Each row is expanded individually left to right, meaning that - within the same row - a cell may refer to a variable bound in a column further to the left. Then the 'Database' node registers itself with the 'Data driver' context. The result columns of the used SQL statement will be used for the variable names. The capitalization depends on the database driver, e.g. completely capitalized letters for Oracle. A property group called like the node will be created additionally. That group contains the variables size and totalsize. size shows the number of data rows with taking care about iteration intervals. The variable totalsize shows the total number of data rows without taking care about iteration intervals. When all 'Data binders' have been registered the 'Test set' will query the 'Database' in order to iterate over the available sets of data. If no such context is available the respective property group will be extended with all variables.

Attributes:

'Database' attributes
Figure 41.16:  'Database' attributes
'Name'

The 'Name' of a 'Data binder' is mandatory. It is used to distinguish 'Data binders' in the same 'Data driver' context. A 'Break' node executed during data-driven testing can be used to break out of a specific loop by referring to the 'Data binder's' 'Name'.

Variable: Yes

Restrictions: None

'Iteration counter'

The name of the variable that the iteration counter will be bound to.

Variable: Yes

Restrictions: None

'Iteration ranges'

An optional set of indexes or ranges to use from the bound data. This is especially useful during test development in order to run sample tests with just a single index or a subset of the given data.

Ranges are separated by ','. Each range is either a single index or an inclusive range of the form 'from-to' or 'from:to' where 'to' is optional. Indexes or ranges may be specified multiple times, overlap or be given in descending order. Indexes are 0-based, negative indexes are counted from the end, -1 being the last item. An invalid syntax or an index outside the valid data range will cause a BadRangeException.

The following table shows some example range specifications and the resulting indexes, based on a set of 20 entries.

Iteration rangesResulting indexes
0[0]
-2, -1[18, 19]
1-2,4:5[1, 2, 4, 5]
18:,-3-[18, 19, 17, 18, 19]
3-2,16:15[3, 2, 16, 15]
Table 41.7:  Iteration range examples

Note The value bound for the 'Iteration counter' reflects the index in the current interval, not the counter of actual iterations, e.g. if you specify '2' there will be a single iteration with the 'Iteration counter' bound to '2', not '0'.

Variable: Yes

Restrictions: Valid syntax and index values

'SQL statement'

The SQL query that should be executed to get the desired test data. This statement is supposed to be a select statement. Each column will stand for a variable. The capitalization of the columns depends on the kind of the used database driver, e.g. most of the Oracle drivers return completely capitalized variables.

Variable: Yes

Restrictions: Must not be empty

'Driver class'

The class name of the database driver.

Note The jar file with the database driver has to be placed in the qftest plugin directory before launching QF-Test.

Here is a list of the most common database drivers:

Database Classname of JDBC-driver
Borland Interbase interbase.interclient.Driver
DB2 com.ibm.db2.jcc.DB2Driver
Informix com.informix.jdbc.IfxDriver
IDS Server ids.sql.IDSDriver
MS SQL Server 2000 com.microsoft.jdbc.sqlserver.SQLServerDriver
MS SQL Server 2005 com.microsoft.sqlserver.jdbc.SQLServerDriver
mSQL COM.imaginary.sql.msql.MsqlDriver
MySQL com.mysql.jdbc.Driver
Oracle oracle.jdbc.driver.OracleDriver
Pointbase com.pointbase.jdbc.jdbcUniversalDriver
PostgreSQL org.postgresql.Driver
Standard Driver sun.jdbc.odbc.JdbcOdbcDriver
Sybase com.sybase.jdbc2.jdbc.SybDriver
SQLite org.sqlite.JDBC
Table 41.8:  Database drivers

Variable: Yes

Restrictions: Must not be empty

'Connection string'

The connection string for database connection, typically something like: jdbc:databasetype://databasehost/databasename.

Here is a list of the most common database connection strings:

Database Example
Derby jdbc:derby:net://databaseserver:port/
IBM DB2 jdbc:db2://database
HSQLB jdbc:hsqldb:file:database
Interbase jdbc:interbase://databaseserver/database.gdb
MS SQL Server 2000 jdbc:microsoft:sqlserver://databaseserver:
port;DatabaseName=database;
MS SQL Server 2005 jdbc:sqlserver://databaseserver:
port;DatabaseName=database;
MySQL jdbc:mysql://databaseserver/database
PostgreSQL jdbc:postgresql://databaseserver/database
ODBC Data Sources jdbc:odbc:database
Oracle Thin jdbc:oracle:thin:@databaseserver:port:
database
Sybase jdbc:sybase:tds:databaseserver:port/database
SQLite jdbc:sqlite:sqlite_database_file_path
Table 41.9:  'Database' connection strings

Variable: Yes

Restrictions: Must not be empty

'Database user'

The name of the user to use when connecting to the database. If your database connection doesn't require a user you can leave this field empty.

Variable: Yes

Restrictions: None

'Database password'

The password to use when connecting to the database. If your database connection doesn't require a password you can leave this field empty. To that end the password can be encrypted by inserting the plain-text password, right-clicking and selecting »Crypt password« from the popup menu. Please be sure to specify a password salt before encrypting via the option Salt for crypting passwords.

Variable: Yes

Restrictions: None

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

'Excel data file'

An 'Excel data file' is used to load external data from an Excel-file to provide test data for data-driven testing. The first row must contain the names of the variables to bind. The rest of the rows should contain the values to be used for the iteration steps.

Note It is possible that the contents of some cells are not read correctly. This can happen especially for cells of the type "date", "time" or "currency". The reason is that Excel stores the value and the format of a cell separately and the Java package used to parse Excel files doesn't support all possibilities. Still, the 'Excel data file' should read most cells correctly, but in case of problems please change the type of the problematic cells in the Excel file to "text". Once read by QF-Test, all values are treated as strings anyway.

For further details about the data-driving mechanism please see chapter 22.

Contained in: Any

Children: None

Execution: The 'Excel data file' node loads the data from the Excel file and expands variable values in the table according to the option When binding variables, expand values immediately. Each row is expanded individually left to right, meaning that - within the same row - a cell may refer to a variable bound in a column further to the left. Then the 'Excel data file' registers itself with the 'Data driver' context. A property group called like the node will be created additionally. That group contains the variables size and totalsize. size shows the number of data rows with taking care about iteration intervals. The variable totalsize shows the total number of data rows without taking care about iteration intervals. When all 'Data binders' have been registered the 'Test set' will query the 'Excel data file' in order to iterate over the available sets of data. If no such context is available the respective property group will be extended with all variables.

Attributes:

'Excel file' attributes
Figure 41.17:  'Excel data file' attributes
'Name'

The 'Name' of a 'Data binder' is mandatory. It is used to distinguish 'Data binders' in the same 'Data driver' context. A 'Break' node executed during data-driven testing can be used to break out of a specific loop by referring to the 'Data binder's' 'Name'.

Variable: Yes

Restrictions: None

'Iteration counter'

The name of the variable that the iteration counter will be bound to.

Variable: Yes

Restrictions: None

'Iteration ranges'

An optional set of indexes or ranges to use from the bound data. This is especially useful during test development in order to run sample tests with just a single index or a subset of the given data.

Ranges are separated by ','. Each range is either a single index or an inclusive range of the form 'from-to' or 'from:to' where 'to' is optional. Indexes or ranges may be specified multiple times, overlap or be given in descending order. Indexes are 0-based, negative indexes are counted from the end, -1 being the last item. An invalid syntax or an index outside the valid data range will cause a BadRangeException.

The following table shows some example range specifications and the resulting indexes, based on a set of 20 entries.

Iteration rangesResulting indexes
0[0]
-2, -1[18, 19]
1-2,4:5[1, 2, 4, 5]
18:,-3-[18, 19, 17, 18, 19]
3-2,16:15[3, 2, 16, 15]
Table 41.10:  Iteration range examples

Note The value bound for the 'Iteration counter' reflects the index in the current interval, not the counter of actual iterations, e.g. if you specify '2' there will be a single iteration with the 'Iteration counter' bound to '2', not '0'.

Variable: Yes

Restrictions: Valid syntax and index values

'Excel file name'

The name of the Excel file to read the test data. Relative path names are resolved relative to the directory of the test suite.

The button above the attribute brings up a dialog in which you can select the Excel file interactively. You can also get to this dialog by pressing [Shift-Return] or [Alt-Return] when the focus is in the text field.

Variable: Yes

Restrictions: Must not be empty

'Worksheet name'

The name of the worksheet that contains the test data. If empty, the first sheet will be used.

Variable: Yes

Restrictions: None

'Override date format (e.g. MM/dd/yyyy)'

This value specifies a date format which will be used for all date values specified in the Excel file. The format must be specified as for the Java class SimpleDateFormat, i.e. 'd' for day, 'M' for month, 'y' for year. Thus 'dd' stands for two digits of a day and similar for 'MM', ''yy' or 'yyyy'.

Variable: Yes

Restrictions: None

'Variables in rows'

If this attribute is checked, the names of the variables will be taken from the first row. If it's not checked the names will come from the first column.

Variable: Yes

Restrictions: None

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

'CSV data file'

A 'CSV data file' node is used to load external data from a file and make it available for data-driven testing. CSV stands for Comma-separated Values, a more or less standard plain text file format. Each line in the file contains one set of data with the values separated by a separator character, often but not always a comma (','). For use with a 'CSV data file' node the first line of the CSV file must contain the names of the variables to bind. The rest of the lines should contain the values to be used for the iteration steps.

Unfortunately, with CSV files there are non-uniform definitions for things like quoting, white-space, multi-line values or embedded separator characters. Two de-facto standards exist, one used by Microsoft Excel and one by the rest of the world. QF-Test supports both of these. For further details about the data-driving mechanism please see chapter 22.

Contained in: Any

Children: None

Execution: The 'CSV data file' node loads the data from the CSV file and expands variable values in the table according to the option When binding variables, expand values immediately. Each row is expanded individually left to right, meaning that - within the same row - a cell may refer to a variable bound in a column further to the left. Then the 'CSV data file' registers itself with the 'Data driver' context. A property group called like the node will be created additionally. That group contains the variables size and totalsize. size shows the number of data rows with taking care about iteration intervals. The variable totalsize shows the total number of data rows without taking care about iteration intervals. When all 'Data binders' have been registered the 'Test set' will query the 'CSV data file' in order to iterate over the available sets of data. If no such context is available the respective property group will be extended with all variables.

Attributes:

'CSV file' attributes
Figure 41.18:  'CSV data file' attributes
'Name'

The 'Name' of a 'Data binder' is mandatory. It is used to distinguish 'Data binders' in the same 'Data driver' context. A 'Break' node executed during data-driven testing can be used to break out of a specific loop by referring to the 'Data binder's' 'Name'.

Variable: Yes

Restrictions: None

'Iteration counter'

The name of the variable that the iteration counter will be bound to.

Variable: Yes

Restrictions: None

'Iteration ranges'

An optional set of indexes or ranges to use from the bound data. This is especially useful during test development in order to run sample tests with just a single index or a subset of the given data.

Ranges are separated by ','. Each range is either a single index or an inclusive range of the form 'from-to' or 'from:to' where 'to' is optional. Indexes or ranges may be specified multiple times, overlap or be given in descending order. Indexes are 0-based, negative indexes are counted from the end, -1 being the last item. An invalid syntax or an index outside the valid data range will cause a BadRangeException.

The following table shows some example range specifications and the resulting indexes, based on a set of 20 entries.

Iteration rangesResulting indexes
0[0]
-2, -1[18, 19]
1-2,4:5[1, 2, 4, 5]
18:,-3-[18, 19, 17, 18, 19]
3-2,16:15[3, 2, 16, 15]
Table 41.11:  Iteration range examples

Note The value bound for the 'Iteration counter' reflects the index in the current interval, not the counter of actual iterations, e.g. if you specify '2' there will be a single iteration with the 'Iteration counter' bound to '2', not '0'.

Variable: Yes

Restrictions: Valid syntax and index values

'CSV file name'

The name of the CSV file to get the test data from. Relative path names are resolved relative to the directory of the test suite.

The button above the attribute brings up a dialog in which you can select the CSV file interactively. You can also get to this dialog by pressing [Shift-Return] or [Alt-Return] when the focus is in the text field.

Variable: Yes

Restrictions: Must not be empty

'File encoding'

An optional encoding for the CSV file, "UTF-8" for example. If no encoding is specified, the file will be read with the default encoding of the Java VM.

Variable: Yes

Restrictions: The encoding must be supported by the Java VM.

'Read Microsoft Excel CSV format'

If this option is active QF-Test will try to parse the CSV file using the format used by Microsoft Excel.

Variable: Yes

Restrictions: None

'Separator character'

In this attribute you can specify the character to be used as separator for data values within the CSV file. If no separator is defined a comma (',') is used as the default value. If 'Read Microsoft Excel CSV format' is activated this attribute is ignored.

Variable: Yes

Restrictions: None

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

'Data loop'

A 'Data loop' node is a simple loop with a single variable bound as the iteration counter. It is useful for executing 'Test cases' multiple times by placing them inside a 'Test set' with a 'Data driver' holding a 'Data loop'.

Contained in: Any

Children: None

Execution: During execution all the 'Data loop' node does is register itself with the 'Data driver' context. The iteration counter will be used as variable. A property group called like the node will be created additionally. That group contains the variables size and totalsize. size shows the number of data rows with taking care about iteration intervals. The variable totalsize shows the total number of data rows without taking care about iteration intervals. When all 'Data binders' have been registered the 'Test set' will query the 'Data loop' in order to iterate over the available sets of data. If no such context is available the respective property group will be extended with all variables.

Attributes:

'Data loop' attributes
Figure 41.19:  'Data loop' attributes
'Name'

The 'Name' of a 'Data binder' is mandatory. It is used to distinguish 'Data binders' in the same 'Data driver' context. A 'Break' node executed during data-driven testing can be used to break out of a specific loop by referring to the 'Data binder's' 'Name'.

Variable: Yes

Restrictions: None

'Iteration counter'

The name of the variable that the iteration counter will be bound to.

Variable: Yes

Restrictions: None

'Iteration ranges'

An optional set of indexes or ranges to use from the bound data. This is especially useful during test development in order to run sample tests with just a single index or a subset of the given data.

Ranges are separated by ','. Each range is either a single index or an inclusive range of the form 'from-to' or 'from:to' where 'to' is optional. Indexes or ranges may be specified multiple times, overlap or be given in descending order. Indexes are 0-based, negative indexes are counted from the end, -1 being the last item. An invalid syntax or an index outside the valid data range will cause a BadRangeException.

The following table shows some example range specifications and the resulting indexes, based on a set of 20 entries.

Iteration rangesResulting indexes
0[0]
-2, -1[18, 19]
1-2,4:5[1, 2, 4, 5]
18:,-3-[18, 19, 17, 18, 19]
3-2,16:15[3, 2, 16, 15]
Table 41.12:  Iteration range examples

Note The value bound for the 'Iteration counter' reflects the index in the current interval, not the counter of actual iterations, e.g. if you specify '2' there will be a single iteration with the 'Iteration counter' bound to '2', not '0'.

Variable: Yes

Restrictions: Valid syntax and index values

'Number of iterations'

The number of iterations of the loop.

Variable: Yes

Restrictions: > 0

'QF-Test ID'

At the moment the 'QF-Test ID' attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

'Delay before/after'

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

'Comment'

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for 'Test set', 'Test case' or 'Procedure' nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing [Alt-Return] or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a 'Component' node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None