Version 8.0.1 |
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.
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:
Figure 41.14: 'Data driver' attributes |
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
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
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:
| |||||||||||||||||||||||||||||||||||
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 '_'.
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
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 ('_').
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
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 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
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:
Figure 41.15: 'Data table' attributes |
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
The name of the variable that the iteration counter will be bound to.
Variable: Yes
Restrictions: None
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.
| |||||||||||||||
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
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
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 ('_').
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
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 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
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 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:
Figure 41.16: 'Database' attributes |
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
The name of the variable that the iteration counter will be bound to.
Variable: Yes
Restrictions: None
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.
| |||||||||||||||
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
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
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:
| |||||||||||||||||||||||||||||||||
Table 41.8: Database drivers |
Variable: Yes
Restrictions: Must not be empty
The connection string for database connection, typically something like:
jdbc:databasetype://databasehost/databasename
.
Here is a list of the most common database connection strings:
| |||||||||||||||||||||||||||||
Table 41.9: 'Database' connection strings |
Variable: Yes
Restrictions: Must not be empty
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
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
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 ('_').
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
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 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
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:
Figure 41.17: 'Excel data file' attributes |
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
The name of the variable that the iteration counter will be bound to.
Variable: Yes
Restrictions: None
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.
| |||||||||||||||
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
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
The name of the worksheet that contains the test data. If empty, the first sheet will be used.
Variable: Yes
Restrictions: None
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
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
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 ('_').
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
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 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
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:
Figure 41.18: 'CSV data file' attributes |
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
The name of the variable that the iteration counter will be bound to.
Variable: Yes
Restrictions: None
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.
| |||||||||||||||
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
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
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.
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
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
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 ('_').
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
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 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
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:
Figure 41.19: 'Data loop' attributes |
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
The name of the variable that the iteration counter will be bound to.
Variable: Yes
Restrictions: None
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.
| |||||||||||||||
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
The number of iterations of the loop.
Variable: Yes
Restrictions: > 0
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 ('_').
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
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 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
Last update: 9/10/2024 Copyright © 1999-2024 Quality First Software GmbH |