Custom Compound Steps and Virtual Phones¶
intaQt's built-in Compound Steps can be replaced by Custom Implementations that are passed as arguments to the Stepdef. This allows for switching between real phones and simulated phones. The builtinTelephonySteps
configuration field as well as the @Telephony
Stepdef annotation are used to enable or disable the availability of custom Stepdefs:
Activating Built-in Telephony Stepdefs ¶
When the builtinTelephonySteps
configuration is activated:
-
intaQt uses real phones and built-in Steps by default.
-
Including the
@Telephony
annotation above a custom Stepdef disables that Stepdef from being called by intaQt.
Deactivating Built-in Telephony Stepdefs ¶
When the builtinTelephonySteps
configuration is deactivated:
- intaQt uses simulated phones and custom Steps by default.
- Including the
@Telephony
annotation in a Stepdef enables the custom Stepdef. This allows intaQt to recognize the Stepdef as a custom implementation.
- Including the
Parse Custom Compound Stepdefs ¶
A Telephony Built-in exposes five parsing functions, which facilitate the use of custom Compound Steps:
-
Telephony.parseCallDetails
-
Telephony.parsePhoneSelection
-
Telephony.parseSmsDetails
-
Telephony.parseDownloadDetails
-
Telephony.parseUploadDetails
These functions return a map of all Step Details available for the event type such as Voice Call, SMS or Upload. The keys are the Step Details, and the values are the results of each detail. If Step Details are omitted from the Step, their default values are applied to the map. Further information for each parsing function is included below.
Custom Compound Steps |
---|
Configuration |
@Telephony Annotation |
Parse Call Details |
Parse Phone Selection |
Parse SMS Details |
Parse Download Details |
Parse Upload Details |
Configure Custom Compound Steps ¶
By default, intaQt's built-in Compound Steps are activated. Deactivating the built-in Steps via the Glue
path configuration enables replacing the built-in Steps with custom implementations. Additionally, when the builtinTelephonySteps
Steps are deactivated, intaQt's built-in Steps become unavailable. Instead, intaQt accesses the custom Steps pointed to by the Glue
path.
To configure default Step Detail parameters, such as ringing duration, refer to Configure Compound Step Default Parameters
Syntax
1 2 3 4 | Glue { path = [<String>, ...] builtinTelephonySteps = <String> } |
Parameters
-
path - Points to the path where the custom Compound Steps are located
-
builtinTelephonySteps - Whether intaQt's built-in Compound Steps are available or not
- Must be one of
"activated"
or"deactivated"
- Must be one of
Example
1 2 3 4 | Glue { path = ["/home/user/QiTASC/intact/customsteps"] builtinTelephonySteps = "deactivated" } |
@Telephony Annotation ¶
Using the @Telephony
annotation above custom Stepdefs enables/disables these Stepdefs, depending on whether builtinTelephonySteps
is set to activated
or deactivated
. This prevents conflicts from occurring between Built-ins and custom Stepdefs that share the same signature.
-
The annotation disables custom Steps when
builtinTelephonySteps
is set toactivated
. -
The annotation enables custom Steps when the configuration is set to
deactivated
.
Syntax
1 2 3 4 | @Telephony stepdef "..." ... end |
Custom Stepdef with @Telephony Annotation Example
1 2 3 4 | @Telephony stepdef "{phone} starts a call to {phone} as {id}:" / A, B, call, details / // todo implement end |
In the example above, the custom Stepdef has the same signature as intaQt's built-in Voice Call Compound Step, <phone> starts a called to <phone> as <callName>:
. The @Telephony
annotation tells intaQt to disable the custom Stepdef when builtinTelephonySteps
is set to activated
. However, when builtinTelephonySteps
is set to deactivated
, the custom Step will be used instead of the built-in Voice Call Compound Step.
Because the Steps share a signature, they both appear the same within a Feature File (line 10
in the example below.)
Feature File Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | Feature: callCompoundStep Scenario: callCompoundStepScenario Given a phone as A: * of type Android * where operator == "3 AT" * with profile Vienna And a phone as B: * of type Android And A starts a call to B as MYCALL: * detect incoming call within 10 seconds * call duration is 7 seconds * caller ends the call * caller connects within 5 seconds * callee connects within 5 seconds * caller dials nat format * callee expects signaled number in any format * ringing duration is 8 seconds And expect the call MYCALL to start ringing And expect the call MYCALL to connect And expect the call MYCALL to disconnect |
Parse Call Details ¶
The parseCallDetails
Function is used in conjunction with the Compound Step A starts a call to B as CALL:
. It takes the identifiers of the caller
and callee
and any Step Details specified with the custom Step and returns a map of the following Step Details as keys:
-
callDisconnectsWithinSeconds - Number
-
callDuration - String
-
callDurationUnit - Number
- The default is set to a random number between
2
and20
- The default is set to a random number between
-
calleeConnectsWithinSeconds - Number
-
calleDoesNotAnswer - Boolean
-
calleeId - Call Destination
-
callerAbandonsTheCall - Boolean
-
callerConnectsWithinSeconds - Number
-
callerId - String
-
callForward - Call forwarding details
- Must be one of
unconditional
,not reachable
,busy
orno answer
- Must be one of
-
callIsRelayedTo - Call destination
-
detectCallWithinSeconds - Number
- Default is set to
30
- Default is set to
-
detectFormat - String
- Default is set to
"any"
- Default is set to
-
dialFormat - String
- Default is set to
"int"
- Default is set to
-
hangupBy - The call party who hangs up
-
networkRejectsTheCallWithinSeconds - Number
-
notDetectCallWithinSeconds - Number
-
ringDuration - Number
- Default is set to a random number between
2
and6
- Default is set to a random number between
-
signaledNumber - String
-
speechChannelMonitor - Number
Syntax
1 2 | <parsedCallDetails Map> := Telephony.parseCallDetails(<caller Identifier>, <callee Identifier>, [<details String>, ...]) |
Returns
The map of parsed call details. If Step Details are not specified, their default values are applied to the map.
Parameters
-
caller - The the phone making the call
-
callee - The the phone receiving the call
-
details - The call details
If Step Details are not specified, their default values are applied to the map.
Stepdef Example
1 2 3 4 5 6 7 8 | stepdef "{ident} starts a call to {ident} as {ident}:" / caller, callee, call, details / println("Details: " + details) phoneCallMap := Telephony.parseCallDetails(caller, callee, details) for k,v in phoneCallMap println(k + " => " + PrintUtil.checkNull(v)) end end |
In the example above, the Stepdef contains String Parameters, indicated by the {ident}
markers. These are treated like standard {}
argument markers, but the arguments' values are not evaluated before passing them to the Feature File. This means that a phone called A
is passed as the string argument A
when using {ident}
. If the argument is instead defined with {}
, intaQt tries to resolve the phone called A
. If such a phone is present in the current execution context, the associated phone instance will be used.
Parse Phone Selection ¶
The parsePhoneSelection
is used in conjunction with the Compound Step Given a phone as/Given phones as <name/s> :
. It takes a details string as input and returns a map that contains the following phone selection details as keys:
-
criteria - String
-
location - String
-
profile - String
-
type - String
- Default is set to
"any"
- Default is set to
Syntax
1 2 | <parsedPhoneDetails Map> := Telephony.parsePhoneSelection([<details String>, ...]) |
Returns
The map of parsed phone details. If Step Details are not specified, their default values are applied to the map.
Parameter
- details - The Step Details
Example
1 2 3 4 5 6 7 | stepdef "a phone as {ident}:" / phone, details / println("Phone details: " + details) phoneSelectionMap := Telephony.parsePhoneSelection(details) for k, v in phoneSelectionMap LOG.debug(k + "=>" + v + ": " + v.getClass().getSimpleName()) end end |
Parse SMS Details ¶
The parseSmsDetails
function is used in conjunction with the Compound Step <sender> sends a short message to <receiver> as <smsName>:
. It takes a details string as input and returns a map that contains the following phone selection details as keys:
-
deliveryConfirmedWithinSeconds - Number
- Default is set to
-1
- Default is set to
-
isSmsRejected - Boolean
- Default is set to
false
- Default is set to
-
receiveFormat - String
- Default is set to
"any"
- Default is set to
-
receiver - List of message destinations
-
receptionWithinSeconds - Number
- Default is set to
-1
- Default is set to
-
sendFormat - String
- Default is set to
"int"
- Default is set to
-
sender - String
-
sendText - String
- Default is set to
"Hello intaQt !"
- Default is set to
-
storeReceivedMessageAs - String
Syntax
1 2 | <parsedSmsDetails Map> := Telephony.parseSmsDetails(<sender Identifier>, <receiver Identifier>, <smsName Identifier>, <details String>) |
Returns
The map of parsed SMS transfer details. If Step Details are not specified, their default values are applied to the map.
Parameters
-
sender - The phone sending the SMS
-
receiver - The phone receiving the SMS
-
smsName - The name assigned to the SMS event
-
details - The SMS details
Example
1 2 3 4 | stepdef "{ident} sends a short message to {ident} as {ident}:" / sender, receiver, transfer, details / smsDetailsMap := Telephony.parseSmsDetails(sender, receiver, transfer, details) ... end |
Using the example Stepdef above, a Feature File containing Given A sends a short message to B as MYSMS
would call the Stepdef with the parameters A
,B
, and MYSMS
for the respective sender
, receiver
and transfer
IDs.
Parse Download Details ¶
The parseDownloadDetails
function is used in conjunction with the Compound Step <phone> starts a download from <url> as <dataName>:
. It takes a details string as input and returns a map that contains the following download details as keys:
-
connectTimeoutSeconds - BigDecimal
- Default is set to
-1
- Default is set to
-
dataVolumeAmount - BigDecimal
- Default is set to
-1
- Default is set to
-
dataVolumeUnit -
"bytes"
-
durationSeconds - BigDecimal
- Default is set to
-1
- Default is set to
-
inactivityTimeoutSeconds - BigDecimal
-
intervalLenMillis - BigDecimal
Syntax
1 2 | <parsedDownloadDetails Map> := Telephony.parseDownloadDetails(<phone Identifier>, <url String>, <dataName Identifier>, [<details String>, ...]) |
Returns
The map of parsed download details. If Step Details are not specified, their default values are applied to the map.
Parameters
-
phone - The phone downloading the data
-
url - The URL the data is being downloaded from
-
dataName - The name assigned to the data session
-
details - The download details
Example
1 2 3 4 5 | stepdef "{ident} starts downloading data from {} as {ident}:" / downloader, url, downloadId, details / println("Details: " + details) downloadDetailsMap := Telephony.parseDownloadDetails(details) ... end |
Using the example Stepdef above, a Feature File containing And A starts downloading data from "http://testdata.qitasc.com/upload" as Download1
would call the Stepdef with the parameters A
,"http://testdata.qitasc.com/upload"
, and Download1
for the respective phone
, url
and dataName
IDs.
Parse Upload Details ¶
The parseUploadDetails
function is used in conjunction with the Compound Step <phone> starts uploading random data to <url> as <dataName>:
. It takes a details string as input and returns a map that contains the following upload details as keys:
-
dataVolumeAmount - BigDecimal
- Default is set to
-1
- Default is set to
-
dataVolumeUnit -
"bytes"
-
durationSeconds - BigDecimal
- Default is set to
-1
- Default is set to
-
inactivityTimeoutSeconds - BigDecimal
-
reconnects - BigDecimal
- Default is set to
0
- Default is set to
Syntax
1 2 | <parsedUploadDetails Map> := Telephony.parseUploadDetails(<phone Identifier>, <url String>, <dataName Identifier>, [<details String>, ...]) |
Returns
The map of parsed upload details. If Step Details are not specified, their default values are applied to the map.
Parameters
-
phone - The phone uploading the data
-
url - The URL the data is being uploaded to
-
dataName - The name assigned to the data session
-
details - The upload details
Example
1 2 3 4 5 | stepdef "{ident} starts uploading random data to {} as {ident}:" / uploader, url, uploadId, details / println("Details: " + details) uploadDetailsMap := Telephony.parseUploadDetails(details) ... end |
Using the example Stepdef above, a Feature File containing And A starts uploading random data to "http://testdata.qitasc.com/upload" as Upload1
would call the Stepdef with the parameters A
,"http://testdata.qitasc.com/upload"
, and Upload1
for the respective phone
, url
and dataName
IDs.
Enable Virtual Phones for CDR Copying ¶
The registerPhone()
method makes the phone available for copying CDRs. This enable copying CDRs by intaQt Verification when using Virtual Phones.
Register Phone ¶
The registerPhone()
method posts the PhoneAcqired
event, which notifies the CdrInfoRecorder
. After setting the Virtual Phone properties (number, IMEI, IMSI), the registerPhone()
method must be called.
For backwards compatibility reasons, Virtual Phone properties may be optionally accessed using .prop
.
Example
1 2 3 4 5 6 7 8 9 | stepdef "a phone as {phoneTag}:" / id, details / virtualPhone := getContextObject(id) virtualPhone.number := "12345" virtualPhone["imsi"] := "imsi" virtualPhone.registerPhone() println(virtualPhone.getId()) println(virtualPhone.prop.number) println(virtualPhone.id) end |