Using List Parameters¶
Now that you can use the following Stepdef parameter types {}
, {ident}
, {phoneTags}
, and {phoneTag}
. There is one more Stepdef parameter type, {list}
you should familiarize yourself with.
1. Using List Parameters¶
This parameter type yields a list of objects that is passed as a single parameter (a list) to the Stepdef. Before being passed on, the list is evaluated, so it can consist of arbitrary expressions referring to the scenario execution context.
Note |
---|
The list elements can be separated by commas (, ) or the keyword and as described above . If you want to use and as a boolean operator, the corresponding element expression must be enclosed in parentheses (() ) to avoid confusing separators and boolean operators. |
Stepdef Example
1 2 3 4 5 | stepdef "create the list {list}" / param / for el in param println("" + el) end end |
Feature File Example
1 | And create the list 1, (true and false), "abc" and 23 +3, 22 |
This creates a list [1, false, "abc", 26, 22]
and passes it with the name param
to the Stepdef.
Remove the parentheses around the boolean expression like below:
1 | And create the list 1, true and false, "abc" and 23 +3, 22 |
The and
between true
and false
is interpreted as a list element delimiter, so param
is then [1, true, false, "abc", 26, 22]
.
Conclusion¶
The tutorials of "Using Custom Stepdefs and Virtual Phones" has shown you how to replace intaQt's built-in Telephony Stepdefs with your own custom implementations, which allows you to use virtual phones in place of real phones. We also demonstrated how to use all five parameter types within your Stepdefs.
If you would like to create more test cases using either virtual phones or regular phones, the intaQt manual's General Concepts chapter provides reference material about different test case components including Stepdefs, Feature Files and intaQt's languages. The intaQt manual's Steps and Compound Steps chapter details available Built-in steps for use cases including Telephony, SMS, data and interactive phone steps.