Expecting a Call Detail's Occurrence Steps¶
The Call Compound Step is associated with the following Expectation Steps that test whether the call enters a specific state within a given timeout:
-
Start and stop ringing
-
Connect and disconnect
-
Incoming call is not detected
-
Call is rejected by callee or network
-
Call is abandoned
Using one or more expect
steps blocks the test case execution until the given call state is reached. If the call state is not reached within the timeout, the step fails.
Note: Certain steps are incompatible with each other. If Incompatible Step Details are used, an exception will be printed to the log.
Calculating the Timeout in Expectation Steps¶
When the expect
call detail variants do not include a specified timeout (within <Number> seconds
), the number of seconds/minutes to wait will be deduced based on the sum of all timeouts of the corresponding Step Detail and all of its preceding Step Details.
Example
1 2 3 4 5 6 | And A starts a call to B as MY_CALL: * detect incoming call within 7 seconds * ringing duration is 5 seconds * caller connects within 8 seconds And expect the call MY_CALL to connect |
In this example, the within
clause is omitted from the Expectation Step. Therefore, 7
+ 5
+ 8
= 20
seconds is used as the timeout because the call must connect at most within the sum of:
-
The
detection
timeout -
the
ringing duration
-
and the
caller connection
timeout
Expect the Call to Start Ringing ¶
Confirms that the call initiated from the Compound Step is established and callee
has started ringing within a certain period.
Note:
-
If no timeout is specified in the
expectation
step, the number of seconds specified in the Detect Incoming Call detail will be used as the timeout. -
If the Detect Incoming Call Step Detail is not specified, a default of
30
seconds will be used.
Syntax
1 2 3 4 | // Does not specify timeout expect the call <callName Identifier> to start ringing // Specifies the timeout within <time Number> seconds, expect the call <callName Identifier> to start ringing |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
Example
1 2 3 | And A starts a call to B as MY_CALL: * detect incoming call within 7 seconds And expect the call MY_CALL to start ringing |
In the example above, the ringing
Expectation Step will use 7 seconds
as the timeout.
Expect the Call to Stop Ringing ¶
Confirms that the call initiated from the Compound Step is established and callee
has stopped ringing within a certain period. It may only to be used in the use case where the Callee Does Not Answer Step Detail is used within the Call Compound Step.
Note:
-
If no timeout is specified in the expectation Step, the Callee Does Not Answer will be used as the expectation step timeout.
-
When the expectation timeout is not provided explicitly, it will be calculated from the timeouts provided in the step details (see
Example 2
below).
Syntax
1 2 3 4 | // Does not specify timeout And expect the call <callName Identifier> to stop ringing // Specifies the timeout And within <timeout Number> <timeUnit>, expect the call <callName Identifier> to stop ringing |
Parameters
-
callName- The name assigned to the call
-
timeout - The number of
timeUnits
to wait for the party to disconnect before timing out -
timeUnit - Must be one of millisecond, milliseconds, second, seconds, minute or minutes
Example 1 - Explicitly-Provided Expectation Timeout
1 2 3 4 | And A starts a call to B as EXAMPLE_CALL: * callee does not answer And within 30 seconds, expect the call EXAMPLE_CALL to stop ringing |
In the example above, the explicitly-provided expectation timeout of 30
seconds will be used for the expectation step.
Example 2 - Implicitly Calculated Expectation Timeout
1 2 3 4 5 6 | And A starts a call to B as EXAMPLE_CALL: * detect incoming call within 20 seconds * ringing duration is 5 seconds * callee does not answer And expect the call EXAMPLE_CALL to stop ringing |
In the example above, the expectation timeout will be 20
+ 5
+ 5
= 30
seconds, because it was calculated from the timeouts provided in the step details.
Do Not Expect the Call to Start Ringing ¶
Confirms that the call initiated from the Compound Step does not start ringing within a timeout period.
Syntax
1 2 | within <time Number> <timeUnit TimeUnit>, do not expect the call <callName Identifier> to start ringing |
Parameters
-
time - The specified number of seconds
-
timeUnit - One of
milliseconds
,seconds
,minutes
orhours
-
callName - The name assigned to the call
Example
1 | within 5 seconds, do not expect the call MYCALL to start ringing |
Expect the Call to Connect ¶
Confirms that the call initiated from the Compound Step connects within a timeout period.
Note:
-
If no timeout is specified in the
expectation
Step, the number of seconds specified in the Caller Connects or Callee Connects Step Detail will be used as the timeout. -
If neither the Caller Connects nor the Callee Connects Step Detail is specified, a default of
300
seconds will be used. -
If the call has already reached the ringing status when the
connect
Expectation Step is called, the time needed until the call reaches theringing
status will be deducted from theconnect
timeout.
Syntax
1 2 | expect the call <callName Identifier> to connect within <time Number> seconds, expect the call <callName Identifier> to connect |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
Example
1 2 3 4 5 6 | And A starts a call to B as MY_CALL: * detect incoming call within 7 seconds * ringing duration is 5 seconds * caller connects within 8 seconds And expect the call MY_CALL to connect |
In the example above, the timeout will be one of:
-
detection timeout (7)
+ringing duration (5)
+caller connection timeout (8)
= 20 seconds, when theringing
status is not yet reached. -
caller connection timeout (8)
= 8 seconds when theringing
status is already reached.
Do Not Expect the Call to Connect ¶
Confirms that the call initiated from the Compound Step does not connect within a timeout period.
Syntax
1 2 | within <time Number> <timeUnit TimeUnit>, do not expect the call <callName Identifier> to connect |
Parameters
-
time - The specified number of seconds
-
timeUnit - One of
milliseconds
,seconds
,minutes
orhours
-
callName - The name assigned to the call
Example
1 | within 5 seconds, do not expect the call MYCALL to connect |
Expect the Call to Disconnect ¶
Confirms that the call initiated from the Compound Step disconnects within a timeout period.
Note:
-
If no timeout is specified in the
disconnect
Expectation Step, the number of seconds specified in the Call Duration Step Detail will be used as the timeout. -
If the Call Duration Step Detail is not specified, a random number between
2
and20
seconds will be used. -
If the call has already reached the ringing or connected status when the
disconnect
expectation detail is called, the time needed until the call reaches the ringing or connected status will be deducted from thedisconnect
timeout.
Syntax
1 2 | expect the call <callName Identifier> to disconnect within <time Number> seconds, expect the call <callName Identifier> to disconnect |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
Example
1 2 3 4 5 6 7 8 | And A starts a call to B as MY_CALL: * detect incoming call within 7 seconds * ringing duration is 5 seconds * caller connects within 8 seconds * callee connects within 6 seconds * call duration is 27 seconds And expect the call MY_CALL to disconnect |
In the example above, the timeout will be one of:
-
detection timeout (7)
+ringing duration (5)
+caller connection timeout (8)
+callee connection timeout (6)
+call duration (27)
= 46 seconds when neither ringing nor connected status is already reached. -
ringing duration (5)
+caller connection timeout (8)
+callee connection timeout (6)
+call duration (27)
= 39 seconds when ringing status is already reached but connected not yet. -
call duration (27) = 27 seconds
when both ringing and connected statuses are already reached.
Do Not Expect the Call to Disconnect ¶
Confirms that the call initiated from the Compound Step does not disconnect within a timeout period.
Syntax
1 2 | within <time Number> <timeUnit TimeUnit>, do not expect the call <callName Identifier> to disconnect |
Parameters
-
time - The specified number of seconds
-
timeUnit - One of
milliseconds
,seconds
,minutes
orhours
-
callName - The name assigned to the call
Example
1 | within 10 seconds, do not expect the call MYCALL to disconnect |
Expect the Call Not to be Established ¶
Confirms that the call initiated from the call Compound Step is not established by callee
.
Note:
- If no timeout is specified in the
not to be established
Expectation Step, the number of seconds specified in the Callee Does Not Detect Call Step Detail will be used as the timeout.
Syntax
1 2 | expect the call <callName Identifier> not to be established within <time Number> seconds, expect the call <callName Identifier> not to be established |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
In the following example the call should not be established, due to the B
being in airplane mode.
Example
1 2 3 4 5 6 7 | And deferred, within 20 seconds, B disables airplane mode And within 20 seconds, B enables airplane mode And A starts a call to B as MY_CALL: * callee does not detect an incoming call within 11 seconds And expect the call MY_CALL not to be established |
Expect the Call to be Rejected ¶
The expect the call <callName> to be rejected
Step may be used with two different Step Details:
-
callee rejects the call
-
network rejects the call
Expect the Callee to Reject the Call ¶
Syntax
1 2 | expect the call <callName Identifier> to be rejected within <time Number> seconds, expect the call <callName Identifier> to be rejected |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
Example
1 2 3 4 5 | And A starts a call to B as MY_CALL: * detect incoming call within 7 seconds * callee rejects the call And expect the call MY_CALL to be rejected |
In the example above, when the within
clause is omitted from the Expectation Step. This means the timeout is 7
+ a random number between 2
and 5
seconds because the call must be rejected within the sum of the detection timeout and the rejection timeout.
Note:
-
If no timeout is specified in the
reject
Expectation Step, the timeout is calculated from the length of the Detect Incoming Call plus a random number between2
and5
. -
If the Detect Incoming Call Step Detail is not specified, a default value of
30
seconds will be used.
Expect the Network to Reject the Call ¶
Important! When using the network rejects the call
Step Detail, both phones must be intaQt-controlled and a timeout must be specified.
Syntax
1 2 | expect the call <callName Identifier> to be rejected within <time Number> seconds, expect the call <callName Identifier> to be rejected |
Parameters
-
time - The specified number of seconds
-
callName - The name assigned to the call
Example
1 2 3 4 5 6 | Given phones as A and B: * of type Android And A starts a call to B as MY_CALL: * network rejects the call within 13 seconds And expect the call MY_CALL to be rejected |
In the example above, when the within
clause is omitted from the Expectation Step, the timeout is 13
seconds because the call must be rejected within the network rejection timeout.
Expect the Call to Be Abandoned ¶
Determines the amount of time that is required for the caller
to abandon the call. It may only to be used in the use case where the Caller Abandons the Call Step Detail is used within the Call Compound Step.
Syntax
1 2 3 4 | // Does not specify timeout And expect the call <callName Identifier> to be abandoned // Specifies timeout And within <timeout Number> <timeUnit>, expect the call <callName Identifier> to be abandoned |
Parameters
callName - The name assigned to the call
timeout - The number of timeUnits to wait for the call to be abandoned before timing out
timeUnit - Must be one of millisecond
, milliseconds
, second
, seconds
, minute
or minutes
If no timeout is specified in the expectation step, the number of seconds specified in the ringing duration
Step Detail plus a constant overhead of 2 seconds will be used as the timeout.
Example 1- Explicitly-Provided Expectation Timeout
1 2 3 | And A starts a call to B as EXAMPLE_CALL: * caller abandons the call after ringing duration elapsed And within 30 seconds, expect the call EXAMPLE_CALL to be abandoned |
In the example above, the explicitly-provided expectation timeout will be used for the expectation step.
Example 2 - Implicitly-Calculated Expectation Timeout
1 2 3 4 5 | And A starts a call to B as EXAMPLE_CALL: * detect incoming call within 20 seconds * ringing duration is 5 seconds * caller abandons the call after ringing duration elapsed And expect the call EXAMPLE_CALL to be abandoned |
In example above, the expectation timeout will be calculated as 20
+ 5
+ 2
= 27
seconds.
Test Case Example ¶
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Feature: callCompoundStep Scenario: callCompoundStepScenario Given an Android phone as A And an Android phone as B And A starts a call to B as MYCALL: * detect incoming call within 10 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 * call duration is 11 seconds * ringing duration is 8 seconds // Expectation Steps And expect the call MYCALL to start ringing Then expect the call MYCALL to connect ... |