Handbuch

36.6
Control structures

Besides the standard sequence types QF-Test has a set of special control structures. Conditional processing is handled via 'If', 'Elseif' and 'Else' nodes. 'Loops' and 'While' nodes can be aborted with a 'Break' node. Exceptions are handled by 'Try', 'Catch' and 'Finally' nodes.

Beyond that, full scripting is available for the Jython language (formerly called JPython), Groovy and JavaScript as documented in chapter 12.

36.6.1
'Loop'

This node is basically the same as a 'Sequence' except that its children can be executed more than once. This is useful in two ways. For one thing, a test sequence that executes OK a hundred times is more trustworthy than a sequence that only runs once. The other use is to run a number of similar jobs with slight variations. To that end, the count of the current iteration is bound as a variable during execution.

Special 'Loops' with varying increments can be achieved by changing the value of the 'Iteration counter' during execution.

Execution of a 'Loop' can be terminated prematurely with the help of a 'Break' node. An optional 'Else' node may be placed at the end of the 'Loop'. It is executed if all iterations of the 'Loop' are run through completely without hitting a 'Break'.

Contained in: All kinds of sequences.

Children: Any

Execution: The 'Variable definitions' of the 'Loop' are bound. The 'Iteration counter' is initialized to 0 and the child nodes are executed one by one. For each iteration the 'Iteration counter' is increased by one and the children are executed again. After the final execution of the last child is complete, the 'Iteration counter' and the 'Variable definitions' are unbound again.

Attributes:

Loop attributes
Figure 36.25:  'Loop' attributes
'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'Number of iterations'

The number of iterations of the loop.

Variable: Yes

Restrictions: > 0

'Iteration counter'

The name of the variable that will hold the iteration count during the execution. Make sure to use different 'Iteration counter' names for nested loops.

Variable: Yes

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

Restrictions: None

'QF-Test ID'

The 'QF-Test ID' of the 'Loop' node can be used in a 'Break' node to terminate an outer loop explicitly when loops are nested.

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.2
'While'

This is a sequence that is executed repeatedly as long as a condition is fulfilled.

The loop can be terminated prematurely with the help of a 'Break' node.

Contained in: All kinds of sequences.

Children: Any

Execution: The 'Variable definitions' of the 'While' node are bound. If the condition evaluates to true, the child nodes are executed one by one. This is repeated until the condition evaluates to false or the loop is terminated through a 'Break' node or an Exception. Finally the 'Variable definitions' are unbound again.

Attributes:

While attributes
Figure 36.26:  'While' attributes
'Condition'

A condition is an expression that evaluates to either true or false. QF-Test discriminates between simple expression that it evaluates itself and complex expressions that are passed to the Jython script language to evaluate.

An empty string or the string false (regardless of case) is interpreted as false, the string true as true. Whole numbers are true if and only if they are non-zero.

Evaluating expressions in Jython opens the way for powerful expression handling. Jython supports the standard operators ==, !=, >, >=, < and <=. You can combine expressions with and and or and define their priority with braces.

Note Accessing QF-Test variables in a condition follows the same rules as in Jython scripts (see subsection 12.2.3). You can use the standard QF-Test syntax $(...) and ${...:...} for numeric or boolean values. String values should be accessed with rc.lookup(...).

Some examples:

Expression Value
Empty String False
0 False
21 True
False False
True True
abc abc Syntax error
25 > 0 True
${qftest:batch} True if QF-Test is run in batch mode
not ${qftest:batch} True if QF-Test is run in interactive mode
rc.lookup("system", "java.version") == "1.3.1" True if JDK Version is 1.3.1
rc.lookup("system", "java.version")[0] == "1" True is JDK Version starts with 1
(1 > 0 and 0 == 0) or 2 < 1 True
Table 36.13:  Condition examples

Variable: Yes

Restrictions: Valid syntax

'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

Restrictions: None

'QF-Test ID'

The 'QF-Test ID' of the 'While' node can be used in a 'Break' node to terminate an outer loop explicitly when loops are nested.

Variable: No

Restrictions: Must not be empty, 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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.3
'Break'

This node is used to terminate a 'Loops' or a 'While' node prematurely.

Contained in: All kinds of sequences.

Children: None

Execution: A BreakException is thrown. If it is caught by a matching loop, the loop is terminated, otherwise it will lead to an error.

Attributes:

Break attributes
Figure 36.27:  'Break' attributes
'QF-Test loop ID'

For nested loops you can specify the loop to terminate by specifying the 'QF-Test ID' of a 'Loop' node and refer to it here. It works with 'QF-Test ID' for a 'While' node respectively. In case this field is empty the innermost loop is terminated. In case you want to break an iteration raised by a 'Data driver' node, you should specify the value of the 'Name' attribute of the respective 'Data driver' node.

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.4
'If'

Like in Java the child nodes of this node are executed only if a condition evaluates to true. However QF-Test differs from common programming languages in the way alternative branches are arranged.

Contained in: All kinds of sequences.

Children: Any executable node, followed by an arbitrary number of 'Elseif' nodes with an optional 'Else' at the end.

Execution: The 'Variable definitions' of the 'If' node are bound. If the condition evaluates to true, the normal child nodes are executed one by one. Otherwise the conditions of the 'Elseif' nodes are evaluated and the first 'Elseif' node whose condition evaluates to true is executed. If none of the conditions are true of no 'Elseif' nodes exist, the 'Else' node is executed, if one exists. Finally the 'Variable definitions' are unbound again.

Attributes:

If attributes
Figure 36.28:  'If' attributes
'Condition'

A condition is an expression that evaluates to either true or false. QF-Test discriminates between simple expression that it evaluates itself and complex expressions that are passed to the Jython script language to evaluate.

An empty string or the string false (regardless of case) is interpreted as false, the string true as true. Whole numbers are true if and only if they are non-zero.

Evaluating expressions in Jython opens the way for powerful expression handling. Jython supports the standard operators ==, !=, >, >=, < and <=. You can combine expressions with and and or and define their priority with braces.

Note Accessing QF-Test variables in a condition follows the same rules as in Jython scripts (see subsection 12.2.3). You can use the standard QF-Test syntax $(...) and ${...:...} for numeric or boolean values. String values should be accessed with rc.lookup(...).

Some examples:

Expression Value
Empty String False
0 False
21 True
False False
True True
abc abc Syntax error
25 > 0 True
${qftest:batch} True if QF-Test is run in batch mode
not ${qftest:batch} True if QF-Test is run in interactive mode
rc.lookup("system", "java.version") == "1.3.1" True if JDK Version is 1.3.1
rc.lookup("system", "java.version")[0] == "1" True is JDK Version starts with 1
(1 > 0 and 0 == 0) or 2 < 1 True
Table 36.14:  Condition examples

Variable: Yes

Restrictions: Valid syntax

'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.5
'Elseif'

This node is an alternative branch in an 'If' node. If the condition of the 'If' node evaluates to false, the first 'Elseif' node whose condition is true is executed.

Contained in: 'If'

Children: Any

Execution: The 'Variable definitions' of the 'Elseif' are bound and its child nodes executed one by one. After the execution of the last child is complete, the variables are unbound again.

Attributes:

Elseif attributes
Figure 36.29:  'Elseif' attributes
'Condition'

A condition is an expression that evaluates to either true or false. QF-Test discriminates between simple expression that it evaluates itself and complex expressions that are passed to the Jython script language to evaluate.

An empty string or the string false (regardless of case) is interpreted as false, the string true as true. Whole numbers are true if and only if they are non-zero.

Evaluating expressions in Jython opens the way for powerful expression handling. Jython supports the standard operators ==, !=, >, >=, < and <=. You can combine expressions with and and or and define their priority with braces.

Note Accessing QF-Test variables in a condition follows the same rules as in Jython scripts (see subsection 12.2.3). You can use the standard QF-Test syntax $(...) and ${...:...} for numeric or boolean values. String values should be accessed with rc.lookup(...).

Some examples:

Expression Value
Empty String False
0 False
21 True
False False
True True
abc abc Syntax error
25 > 0 True
${qftest:batch} True if QF-Test is run in batch mode
not ${qftest:batch} True if QF-Test is run in interactive mode
rc.lookup("system", "java.version") == "1.3.1" True if JDK Version is 1.3.1
rc.lookup("system", "java.version")[0] == "1" True is JDK Version starts with 1
(1 > 0 and 0 == 0) or 2 < 1 True
Table 36.15:  Condition examples

Variable: Yes

Restrictions: Valid syntax

'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.6
'Else'

An 'Else' node is executed if neither the condition of its 'If' parent, nor the condition of its 'Elseif' siblings evaluate to true.

Contained in: 'If', 'Loop', 'Try'

Children: Any

Execution: The 'Variable definitions' of the 'Else' are bound and its child nodes executed one by one. After the execution of the last child is complete, the variables are unbound again.

Attributes:

Else attributes
Figure 36.30:  'Else' attributes
'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.7
'Try'

A 'Try' is a special sequence whose semantic equates the Java try-catch-finally composition. As in Python, this composition was extended to support optional else blocks. A 'Try' behaves the same way as a special 'Sequence' with the extension, that exception handling is possible. Like a 'Sequence' it has a set of normal child nodes that it executes one by one. After these may come an arbitrary number of 'Catch' nodes with an optional 'Else' node followed by an optional 'Finally' node at the end.

If an exception is thrown during the execution of one of the normal child nodes, the 'Catch' nodes are tested for whether they are able to catch that exception. The first one found is executed and the 'Try' will be exited normally afterwards without continuing with the execution of the normal child nodes and without passing the exception on. If no matching 'Catch' is found, the exception will terminate the 'Try' immediately (almost, see below) and be passed onto the 'Try's' parent.

A possible 'Else' child node at the end of a try node will be executed, if and only if no 'Catch' nodes had been executed. This means, it is executed, when no exception in the try block was thrown.

If the 'Try' has a 'Finally' child node, this node will be executed just before the 'Try' finishes, no matter whether an exception is thrown and whether it is handled or not.

Note Exceptions can also be caught implicitly by a 'Test', which is less flexible but often more convenient.

Contained in: All kinds of sequences.

Children: Any executable node, followed by an arbitrary number of 'Catch' nodes with an optional 'Else' node and/or an optional 'Finally' node at the end.

Execution: The 'Variable definitions' of the 'Try' are bound and its normal child nodes executed one by one. If an exception is thrown, execution of the normal children is terminated. If a 'Catch' node with a matching 'Exception class' is found it is executed. Before exiting the 'Try' its 'Finally' node is executed unconditionally. After unbinding the 'Variable definitions', the 'Try' is either exited cleanly if no exception was thrown or the exception was caught, or it passes on the uncaught exception.

Attributes:

Try attributes
Figure 36.31:  'Try' attributes
'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

For a 'Try' node, the error state of the run-log is additionally affected by the 'Maximum error level' of the 'Catch' node that handles an exception.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.8
'Catch'

A 'Catch' is a special 'Sequence' that can only be placed inside a 'Try' node or a 'Dependency'. Its job is to catch exceptions that may arise during the execution of a 'Try's' or a 'Test-case' with a 'Dependency'.

A 'Catch' can handle an exception if the class of the exception is the same as the 'Catch' node's 'Exception class' attribute or a derived class thereof, just as in Java.

Contained in: 'Try', 'Dependency'

Children: Any

Execution: The 'Variable definitions' of the 'Catch' are bound and its child nodes executed one by one. After the execution of the last child is complete, the variables are unbound again.

Attributes:

Catch attributes
Figure 36.32:  'Catch' attributes
'Exception class'

This ComboBox lets you select the class of the exception that is to be caught. All QF-Test exceptions are derived from the class TestException. For details about the possible exceptions see chapter 37.

Variable: No

Restrictions: None

'Expected message'

You can further qualify the exception to catch by specifying a message to look for. If this attribute is empty, all exceptions of the specified class are caught. Otherwise it is compared to exception.getMessage() and the exception is caught only in case of a match.

Variable: Yes

Restrictions: Valid regexp if required.

'As regexp'

If this attribute is set, the exception message is matched against a regexp (see section 42.4) instead of comparing plain strings.

Variable: Yes

Restrictions: None

'Match against localized message'

Most exceptions have two kinds of error message: The raw message is typically some short English text whereas the localized message contains more details and is either English or German, depending on the current language settings of QF-Test. Both are shown in the run-log. If this attribute is set, the localized exception message is used for comparison, otherwise the raw message. The latter is usually preferable as it doesn't depend on language settings so no regexp is needed in order to ensure the correct handling of the different languages.

Variable: Yes

Restrictions: None

'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

In contrast to the 'Maximum error level' of other sequences, this attribute does not determine the error state propagated by the run-log node for the 'Catch' node itself, but for the log of its parent 'Try' node, provided that the 'Catch' is executed in order to handle an exception.

The error state for any warnings, errors or exceptions that happen during the execution of the 'Catch' node are not limited by the setting of this attribute. Otherwise problems occurring during exception handling might accidentally go unnoticed.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.9
'Finally'

A 'Finally' node, which can only be placed at the end of a 'Try' node, will always be executed as the last thing just before exiting the 'Try', no matter what happened there. This is used primarily to ensure that cleanup code like removing a temporary file or terminating a process is executed under any conditions.

Contained in: 'Try'

Children: Any

Execution: The 'Variable definitions' of the 'Finally' are bound and its child nodes executed one by one. After the execution of the last child is complete, the variables are unbound again.

Attributes:

Finally attributes
Figure 36.33:  'Finally' attributes
'Name'

The name of a sequence is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the sequence.

Variable: No

Restrictions: None

'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 7). See subsection 2.2.5 about how to work with the table.

Variable: Variable names no, values yes

Restrictions: None

'Maximum error level'

When a warning, error or exception occurs during a test run, the state of the corresponding node of the run-log is set accordingly. This state is normally propagated to the parent node in a way that ensures that the error state of a run-log node represents the worst of its child nodes' states. Using this attribute, the maximum error state that the run-log node for a sequence will propagate, can be limited.

Note This value has no effect on the way exceptions are handled. It only affects the error states of the run-log nodes and by that the exit code of QF-Test when run in batch mode (see. section 1.7). It also has no effect on the creation of compact run-logs (see command line argument -compact). The node for a sequence in which a warning, error or exception occurs is never removed from a compact log, even if the error is not propagated due to the setting of this attribute.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.10
'Throw'

If you need to handle an exceptional situation, you can use this node to throw an explicit Exception.

Contained in: All kinds of sequences.

Children: None

Execution: A UserException is thrown, its message taken from the 'Exception message' attribute.

Attributes:

Throw attributes
Figure 36.34:  'Throw' attributes
'Exception message'

An arbitrary message for the UserException to throw.

Variable: Yes

Restrictions: Must not be empty.

'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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.11
'Rethrow'

An exception that was caught by a 'Catch' node can be thrown again with the help of a 'Rethrow' node. This is especially useful if you need to catch all kinds of exceptions except one. To handle that case, create a 'Try' node with a 'Catch' for the special exception followed by a 'Catch' for a TestException. Then place a 'Rethrow' in the first 'Catch' node.

Contained in: All kinds of sequences. The 'Rethrow' node doesn't have to be placed directly below a 'Catch' node.

Children: None

Execution: The last exception caught by a 'Catch' node is thrown again. If no such exception exists, a CannotRethrowException is thrown.

Attributes:

Rethrow attributes
Figure 36.35:  'Rethrow' attributes
'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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.12
'Server script'

Server side scripts are executed by an interpreter (Jython, Groovy or JavaScript) embedded into QF-Test. Scripting is explained in chapter 12 and chapter 43. As server side scripts run embedded to QF-Test those scripts cannot interact with the SUT. It is recommended that Server side scripts be used for cases that work without the SUT or time consuming operations like accessing databases or files.

Contained in: All kinds of sequences.

Children: None

Execution: The script is executed by an embedded interpreter.

Attributes:

Server script attributes
Figure 36.36:  'Server script' attributes
'Script'

The script to execute.

Note You may use QF-Test variables of the syntax $(var) or ${group:name} in Jython scripts. They will be expanded before the script is passed to the Jython interpreter. This can lead to unexpected behavior. rc.lookup(...) is the preferred method in this case (see subsection 12.2.3.1 for details).

Note In spite of syntax highlighting and automatical indentation this attribute might not be the right place to write complex scripts. 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 scripts can be edited conveniently by pressing [Alt-Return] or by clicking the Edit row button. Complex scripts can also be written as separate modules which can then be imported for use in this attribute. See chapter 43 for details.

Variable: Yes

Restrictions: Valid syntax

'Script language'

This attribute determines the interpreter in which to run the script, or in other words, the scripting language to use. Possible values are "Jython", "Groovy" and "JavaScript".

Variable: No

Restrictions: None

'Name'

The name of a script is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the script.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None

36.6.13
'SUT script'

Client side scripts are executed by an interpreter (Jython, Groovy or JavaScript) that QF-Test embeds into the SUT. Scripting is explained in chapter 12 and chapter 43. As client side scripts run in the SUT you should use them to access the components and properties of the SUT.

Contained in: All kinds of sequences.

Children: None

Execution: The script is executed inside the SUT by an embedded interpreter.

Attributes:

SUT script attributes
Figure 36.37:  'SUT script' attributes
'Client'

The name of the SUT client process in which to execute the script.

Variable: Yes

Restrictions: Must not be empty.

'Script'

The script to execute.

Note You may use QF-Test variables of the syntax $(var) or ${group:name} in Jython scripts. They will be expanded before the script is passed to the Jython interpreter. This can lead to unexpected behavior. rc.lookup(...) is the preferred method in this case (see subsection 12.2.3.1 for details).

Note In spite of syntax highlighting and automatical indentation this attribute might not be the right place to write complex scripts. 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 scripts can be edited conveniently by pressing [Alt-Return] or by clicking the Edit row button. Complex scripts can also be written as separate modules which can then be imported for use in this attribute. See chapter 43 for details.

Variable: Yes

Restrictions: Valid syntax

'Script language'

This attribute determines the interpreter in which to run the script, or in other words, the scripting language to use. Possible values are "Jython", "Groovy" and "JavaScript".

Variable: No

Restrictions: None

'GUI engine'

The GUI engine in which to execute the script. Only relevant for SUTs with more than one GUI engine as described in chapter 39.

Variable: Yes

Restrictions: See chapter 39

'Name'

The name of a script is a kind of short description. It is displayed in the tree view, so it should be concise and tell something about the function of the script.

Variable: No

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 Edit row button.

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

Variable: Yes

Restrictions: None