Consumables Steps¶
Consumables are one-time values, that can be used once in a test case. They are managed in an SQLite database. The Consumables database can be filled manually, but there is also the option of importing Consumables from an Excel sheet by configuring the ConsumablesImporter
.
The example below shows a Consumable with the name QITASC. Once a Consumable has been selected, it becomes unavailable (status: used
).
Consumables |
---|
ConsumableDB Configuration |
ConsumablesImporter Configuration |
Consumables Step |
Test Case Examples |
Configuration¶
Two different Consumables configurations are available:
-
The ConsumablesDB configuration, which points to the SQLite database
-
The ConsumablesImporter configuration (optional), which imports Consumables from an Excel file upon startup
ConsumableDB Configuration ¶
This configuration points to the SQLite database containing the Consumables. If an empty database is configured, the first time that intaQt starts, it will create the necessary tables.
Syntax
1 2 3 | ConsumableDB { url = <pathToDatabase String> } |
Parameter
- pathToDatabase - The path that points to where the Consumables SQLite database is stored
Example
1 2 3 | ConsumablesDB { url = "/Users/QiTASC/ConsumablesDB" } |
Consumables Importer Configuration (Optional) ¶
Initial Consumables can be entered into the database by using the optional ConsumablesImporter
. Upon starting intaQt, this imports Consumables written from an Excel file.
Important! intaQt must be restarted after making changes to this configuration.
Syntax
1 2 3 4 | ConsumablesImporter { isActive = <isActive Boolean> excelFilepath = <filepath String> } |
-
isActve - When set to
true
, theConsumablesImporter
is activated and the contents of the Excel file are imported into the database upon starting intaQt -
filepath - The path that points to where the Excel file populated with Consumables is stored
Example
1 2 3 4 | ConsumablesImporter { isActive = true excelFilepath = "/Users/QITASC/myExcelFiles" } |
Important! After starting intaQt and importing the Consumables once, the ConsumablesImporter
must be deactivated. Otherwise, the database will be filled a second time, leading to double data entries.
Consumables Step ¶
Syntax
1 2 | a(n) <namespace Identifier> consumable as <variable Identifier> where <criterion String> <operator Operator> <value String> |
Parameters
-
namespace - The namespace, which allows for grouping
- This means all Consumables of the same kind can be addressed by the same name (for example,
myVoucher
)
- This means all Consumables of the same kind can be addressed by the same name (for example,
-
variable - The variable where the selected Consumable is saved in the scenario execution context
-
criterion - The criterion used for selecting the Consumable
-
operator - A comparison operator or logical operator used to compare the criteria against its value
- For example
==
for equal or!=
for not equal - A list of operators can be found in the Operators chapter.
- For example
-
value - The selection criterion
Example
1 | Given a myVoucher consumable as con1 where value == "10" |
myVoucher
namespace that matches the defined criterion, value
of 10
.
Test Case Examples ¶
Using a USSD Menu¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Feature: USSD Scenario: USSDRecharging Given an Android phone as A And A disables data connections And A sends the following ussd "*106#" And within 20 seconds, A receives an ussd response as RESP1 And extract data1 with ussdFirstAccEnq from RESP1.text Given a Voucher consumable as voucher where value == "2" When after 4 seconds, A sends the following ussd "*100#" And within 10 seconds, A receives an ussd response as MainMenuInfo And A responds to interactive ussd with "1" And within 10 seconds, A receives an ussd response as SubMenuSelectAccInfo And A responds to interactive ussd with "1" And within 10 seconds, A receives an ussd response as OwnAccInfo And A responds to interactive ussd with "0123456789" And within 10 seconds, A receives an ussd response as SubMenuConfirmTopUpInfo And A responds to interactive ussd with "1" And A cancels interactive ussd dialog And after 5 seconds, A sends the following ussd "*106#" And within 20 seconds, A receives an ussd response as RESP2 And extract data2 with ussdFirstAccEnq from RESP2.text Then verify data.bal + 2.50 == data2.bal |
Using a DTMF Menu with an Audio Recording¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | Feature: DTMF Scenario: DTMFVoucherRecharging Given an Android phone as A And A disables data connections And A sends the following ussd "*100#" And within 20 seconds, A receives an ussd response as RESP1 And extract data1 with ussdFirstAccEnq from RESP1.text Given a Voucher consumable as voucher where value == "2" When A dials the number "123456" Then an audio recording is started And within 10 seconds, A connects And A switches loudspeaker on And after 35 seconds, A sends "1" as dtmf And after 15 seconds, A sends "3" as dtmf And after 7 seconds, A sends voucher.number + hash as dtmf And after 10 seconds, A ends the call Then an audio recording is stopped And within 15 seconds, A disconnects And within 30 seconds, A receives an ussd response as successfulRecharge Then verify successfulRecharge.text == "Betrag erfolgreich aufgebucht." And A sends the following ussd "*100#" And within 20 seconds, A receives an ussd response as RESP2 And extract data2 with ussdFirstAccEnq from RESP2.text Then verify data1.bal + 2 == data2.bal |