SMS Compound Steps¶
The SMS Compound Step involves the transfer of an SMS to one or more receivers. Optional Step Details define parameters of the SMS transfer, such as its content or the duration in which it should be received. Additional expectation
Steps wait for certain signals emitted during the SMS transfer. All actions that refer to this short message transfer are referenced by an assigned variable, for example, MYSMS
in And A sends a short message to B as MYSMS:
.
In SMS Step Details, the sending party is referred to as the sender
and the receiving party is referred to as the receiver
.
Address the Phones¶
SMS Compound Steps must be preceded by Steps or Compound Steps that address phones and assign them to the test case. For more information, refer to:
Expectation Steps¶
- Certain Step Details need Expectation Steps to confirm the events occur within the timeout. The associated
expectation
Steps are indicated above such Steps. These Steps confirm , such assending
,receiving
,confirming the receipt
andrejecting
and SMS.
Note:
-
A Step Detail omitted from the Step causes the given default value to be used for the short message transfer.
-
Default values may be configured. Refer to Configure Compound Step Default Parameters for additional information.
-
Certain Steps are incompatible with each other. If Incompatible Step Details are used, an exception will be printed to the log.
Send and Receive an SMS ¶
To use the SMS Step Details, a Step must first be created to initiate the SMS transfer.
The Expect the SMS to be Sent and Expect the SMS to be Received Steps should be used with this Step Detail.
Syntax
1 2 | <sender Identifier> sends a short message to <receiver Identifier> as <transfer Identifier>: |
Parameters
-
sender - The party sending the SMS
-
receiver - The party receiving the SMS
-
transfer - The name assigned to the SMS transfer for the Compound Step
- The transfer can be addressed throughout the test case
Example
1 | And A sends a short message to B as MYSMS: |
Important! When using SMS Step Details, a colon (:
) must be placed after the message transfer variable is declared.
SMS Step Details¶
With Text ¶
This Step Detail is used to define the short message's text content.
Syntax
1 | * with text <text String> |
Parameter
- text - The text content to be sent
- The default is set to
"Hello intaQt !"
- The default is set to
Example
1 2 | And A sends a short message to B as MYSMS: * with text "Hello intaQt !" |
Append Text ¶
This Step Detail is used to add additional text content to the with text
Step Detail.
Syntax
1 | * and text <appendText String> |
Parameter
- appendText - Additional lines of text that are appended to the previously given text using newline characters
Example
1 2 3 | And A sends a short message to B as MYSMS: * with text "Hello intaQt !" * and text "This is me" |
Check Reception by Specified Parties ¶
This Step Detail specifies which parties must receive the SMS:
-
The Step Detail will pass if at least every receiver specified within the Step Detail receives the message.
-
If this Step Detail is omitted, the Compound Step will only pass if all specified receivers receive the message.
Syntax
1 2 3 4 5 6 7 | // Single recipient * check reception by <receiver Identifier> within <timeout Number> seconds // Multiple recipients * check reception by <receiver1 Identifier>, ... <receiverN Identifier> within <timeout Number> seconds |
Parameters
-
receiverN - The name assigned to the SMS-receiving party
-
timeout - The time limit in which the SMS must be received
- Default is set to
60
- Default is set to
Example 1
1 2 3 4 5 6 | ... When A sends a short message to B, C and D as MYSMS: * with text "Hello, intaQt !" * check reception by B and C within 20 seconds And within 30 seconds, expect the short message MYSMS to be received |
In the example above, the Stepwill pass if both B
and C
receive the message within 20 seconds. It will fail if either B
or C
do not receive the message within this timeframe. The reception outcome for D
does not influence the Step's success.
Example 2
1 2 3 4 5 6 | ... When A sends a short message to B, C and D as MYSMS: * with text "Hello, intaQt !" * check reception by B, C and D within 20 seconds And within 30 seconds, expect the short message MYSMS to be received |
Check Reception ¶
This clause checks that the sent SMS has been received within a certain period of time. The reception time starts when the short message has been successfully sent.
The Expect the SMS Delivery to be Confirmed Step should be used with this Step Detail.
Syntax
1 | * check reception within <timeout Number> seconds |
Parameters
-
timeout - time limit in which the SMS must be received
- The default (
-1
) means the receipt is not checked for on the receiver's side
- The default (
-
receiverN - The name assigned to the SMS-receiving party
Example
1 2 3 4 | And A sends a short message to B as MYSMS: * with text "Hello intaQt !" * and text "This is me" * check reception within 25 seconds |
Check Delivery Confirmed ¶
If this clause is present, the SMS is sent with a delivery confirmation request on the sender's side. The time count when the SMS has been received on the receiver's side.
Syntax
1 | * check delivery confirmed to the sender within <timeout Number> seconds |
Parameter
- timeout - time limit within which the SMS' delivery must be confirmed to the sender
- The default (
-1
) means a delivery confirmation was not requested
- The default (
Example
1 2 3 4 5 | And A sends a short message to B as MYSMS: * with text "Hello intaQt !" * and text "This is me" * check reception within 25 seconds * check delivery confirmed to the sender within 60 seconds |
SMS is Rejected ¶
This Step Detail allows the receiver to reject an SMS.
The Expect the SMS Delivery to be Rejected Step should be used with this Step Detail.
Syntax
1 2 3 4 | // Without specified timeout * sms is rejected // With specified timeout * sms is rejected within <timeout Number> seconds |
Parameter
- timeout - time limit in which the SMS must be rejected
- Default is set to
30
seconds
- Default is set to
Example Without Timeout
1 2 3 4 5 6 7 8 | Given phones as A and B: * of type Android And A sends a short message to B as MYSMS: * with text "myText" * sms is rejected And within 30 seconds, expect the short message MYSMS to be rejected |
Example With Timeout
1 2 3 4 5 6 7 8 | Given phones as A and B: * of type Android And A sends a short message to B as MYSMS: * with text "myText" * sms is rejected within 25 seconds And within 30 seconds, expect the short message MYSMS to be rejected |
Use Number Format ¶
This Step Detail defines the number format that the sender uses or that the receiver expects.
Syntax
1 2 | * sender uses <formatId Format> format * receiver expects <formatId Format> format |
Parameters
- formatId - The number format
- May be one of
int
,int00
,nat
orany
. For thereceiver expects
Step, the default isany
any
Skips check the sender's number format on the receiver side
- May be one of
Example
1 2 3 4 5 | And A sends a short message to B as MYSMS: * with text "Hello intaQt !" * and text "This is me" * sender uses int format * receiver expects int format |
Store Received Message ¶
This Step Detail stores the content and properties of a received SMS inside Context Objects.
Syntax
1 2 3 4 5 | <sender Identifier> sends a short message to <receiver Identifier> as <transfer Identifier>: * with text <text String> * check reception within <timeout Number> seconds * store received message as <nameContext Identifier> |
Parameter
- nameContext - The created SMS Context Object comprised of a Map
Important! intaQt behaves differently depending on if there is a single or multiple intaQt-controlled parties receiving an SMS.
Single Receiver¶
When a single intaQt-controlled phone receives a short message, the store received message as <nameContext>
Step Detail creates two Context objects: The first Context Object holds a map <nameContext>_map
and the second Context Object <nameContext>
holds a single short message.
In the example below, an SMS Compound Step is created to send a short message to a single intaQt-controlled phone and store the received message. This Compound Step creates the map XYZ_map
, which holds the key according to the receiver ["B"]
, and the Context Object XYZ
, which only stores the message's text content without a key.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Feature: SMSReceivedMessageAsIDSingle Scenario: SMSReceivedMessageAsIDScenarioSingle Given phones as A and B And B sends a short message to A and "+436991234567" as MYSMS: * with text "Store SMS" * check reception within 45 seconds * store received message as XYZ And wait for 10 seconds And within 60 seconds, expect the short message MYSMS to be received Then verify XYZ_map.size() == 1 Then verify XYZ_map["B"].text == "Store SMS" Then verify XYZ_map["B"].originatingNumber == A.number Then verify XYZ.text == "Store SMS" |
Multiple Receiving Parties¶
Sending an SMS within a Compound Step to Multiple Receiving intaQt-controlled phones creates an SMS Context Object, which is comprised of two identical Context Objects: <nameContext>
and <nameContext>_map
. Each Context Object holds a map, which contains the phone identifiers as keys and the SMS properties as their values.
The example below sends one SMS to multiple receiving intaQt-controlled phones. Both the Context Object and the map contain the keys ["B"]
and ["C"]
.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Feature: SMSReceivedMessageAsIDMultiple Scenario: SMSReceivedMessageAsIDScenarioMultiple Given phones as A, B and C And A sends a short message to B, C and "+436991234567890" as MYSMS: * with text "Store SMS" * check reception within 45 seconds * store received message as XYZ And wait for 10 seconds And within 60 seconds, expect the short message MYSMS to be received Then verify XYZ_map.size() == 2 Then verify XYZ.size() == 2 Then verify XYZ_map["B"].text == "Store SMS" Then verify XYZ_map["C"].originatingNumber == A.number Then verify XYZ["B"].text == "Store SMS" Then verify XYZ["C"].originatingNumber == A.number |
Allow Multiple Receivers ¶
The following SMS Compound Step accepts multiple SMS receiving parties. The received short messages are stored in a map whose keys are the identifiers of the receiving phones, while the values contain the short messages.
Syntax
1 2 3 4 | <sender Identifier> sends a short message to <receiver1 Identifier>, ... <receiverN Identifier> as <transfer Identifier>: ... * store received message as <nameContext Identifier> |
Parameters
-
sender - The party sending the SMS
-
receiverN - The name assigned to the SMS receiving party
- The identifier represents either an intaQt-controlled phone or an arbitrary expression that evaluates to a string
- This tells intaQt to interpret the string as a phone number
- The destination list can be:
- A single phone identifier such as
A sends a short message to B
- Multiple identifiers separated by commas:
A sends a short message to B, C
- Multiple identifiers using "and":
A sends a short message to B, C and D
- A single phone identifier such as
-
transfer - The name assigned to the SMS transfer for the Compound Step
- It can be addressed throughout the test case
The example below sends one message from the sender A
to the receiving parties B, C and D
and stores the message to the SMS Context Object identified by XYZ
.
Feature File Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Feature: SMSMultipleDestinations Scenario: SMSMultipleDestinations Give phones as A, B, C and D: * of type Android And A sends a short message to B, C and D as MYSMS: * check reception within 45 seconds * store received message as XYZ And within 60 seconds, expect the short message MYSMS to be received And verify XYZ.size() == 3 And verify XYZ["B"].originatingNumber == A.number And verify XYZ["C"].text == "Hello intaQt!" |
Test Case Example ¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Feature: SMS MetaStep Scenario: A sends a SMS to B using details Given a phone as A: * of type Android * where number == "+4369910637292" And a phone as B: * of type Android * where number == "+436607040433" When A sends a short message to B as MYSMS: * with text "Hello, world" And within 60 seconds, expect the short message MYSMS to be received Then verify MYSMS.sendText == "Hello, world" Then verify MYSMS.sendText.length() == 12 Then verify MYSMS.sender == "A" |