SMS Steps¶
SMS Steps include composing, sending and receiving one or more text messages. The Steps must be written in the order that the actions would be executed during a real-life scenario. Certain Steps may be Timed or Deferred.
Compose a Message ¶
The first Step defines the sending party
and composes an SMS (short message
).
Syntax
1 | <name Identifier> composes a short message |
Parameter
- name - The name assigned to the phone composing the SMS
Example
1 | And A composes a short message |
This Step is eligible for:
-
Timed
-
Deferred
Type Content ¶
After composing the message, its content is specified.
Syntax
1 | <name Identifier> types <messageContent String> |
Parameters
-
name - The name assigned to the phone typing the SMS content
-
messageContent - The content being typed into the SMS
Example
1 | And A types "please confirm receipt" |
This Step is eligible for:
-
Timed
-
Deferred
Send an SMS ¶
After typing the SMS, the send Step is used.
Syntax
1 2 | within <time Number> <timeUnits TimeUnit>, <sender Identifier> sends the short message to <recipient Identifier> |
Parameters
-
sender - The party sending the SMS
-
MessageContent - The SMS' content
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
recipient - The recipient of the SMS
Example
1 | And within 60 seconds, A sends the short message to B.number |
This Step is eligible for:
-
Timed
-
Deferred
In the example above, the sender A
sends a message to the receiving parties B
and C
.
Request a Delivery Report (Optional) ¶
The send with delivery report request
Step can be used instead of the regular send
Step to verify that an SMS has been sent.
Syntax
1 2 | within <time Number> <timeUnits timeUnit>, <sender Identifier> sends the short message with delivery report request to <recipient Identifier> |
Parameters
-
sender - The phone sending the SMS
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
recipient - The recipient of the SMS
Example
1 2 | And within 60 seconds, A sends the short message with delivery report request to B.number |
This Step is eligible for:
-
Timed
-
Deferred
Expect a Message Within a Specified Time ¶
Instead of requesting a delivery report, the expects
Step checks if the short message is delivered within a specified timeframe.
Syntax
1 2 | within <time Number> <timeUnits timeUnit>, <sender Identifier> expects the sent short message to be delivered |
Parameters
-
sender - The phone sending the SMS
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
Example
1 | And within 60 seconds, A expects the sent short message to be delivered |
This Step is eligible for:
- Deferred
Note: There may be extra charges for a delivery report.
Set the SMSC Address (Optional) ¶
This Step sets an SMSC address to the test SMSC address.
Syntax
1 | <name Identifier> sets its smsc address to <smscAddress Identifier> |
Parameters
-
name - The name assigned to the phone setting its SMSC address
-
smscAddress - The name assigned to the test SMSC address
Example
1 | And A sets its smsc address to testSmscAddress |
This Step is eligible for:
-
Deferred
-
Timed
Receive an SMS ¶
This Step ensures that the sent SMS has been received by the other party. It must be used in SMS test cases.
Syntax
1 2 3 4 5 6 | // SMS received from specified number within <time Number> <timeUnits timeUnit>, <recipient Identifier> receives a short message from <sender Identifier> as <smsName Identifier> // SMS received from unidentified sender within <time Number> <timeUnits timeUnit>, <recipient Identifier> receives a short message from "." as SMS |
Parameters
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
recipient - The recipient of the SMS
-
sender - The phone sending the SMS
- If a message's sender is unknown or to indicate and unidentified sender, use
"."
in place of a specifiedsender
- If a message's sender is unknown or to indicate and unidentified sender, use
-
smsName - The name assigned to the SMS received by the
recipient
Example
1 2 3 4 | // SMS received from specified number And within 120 seconds, B receives a short message from A.number as MYSMS // SMS received from unidentified sender Then within 10 seconds, A receives a short message from "." as MYSMS |
This Step is eligible for:
- Deferred
Do Not Receive an SMS ¶
Two Steps test whether or not an SMS was received. The first expects that no text message has been received from the specified sending party
. The other expects that no text message has been received from any party.
Do Not Receive an SMS from a Specified Party¶
Syntax
1 2 | within <time Number> <timeUnits timeUnit>, <recipient Identifier> does not receive a short message from <sender Identifier> |
Parameters
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
recipient - The recipient of the SMS
-
sender - The phone sending the SMS
Example
1 | Then within 80 seconds, B does not receive a short message from A.number |
This Step is eligible for:
- Deferred
Do Not Receive an SMS from Any Party¶
Syntax
1 2 | within <time Number> <timeUnits timeUnit>, <recipient Identifier> receives no short messages |
Parameters
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
recipient - The recipient of the SMS
Example
1 | Then within 80 seconds, B receives no short messages |
This Step is eligible for:
- Deferred
Reject an SMS ¶
An SMS may be rejected for reasons related to the network and/or operator. This Step tests that no SMS has been received. If the SMS is received, the Step will fail.
Syntax
1 2 | within <time Number> <timeUnits timeUnit>, <recipient Identifier> attempts to send the short message to <recipient Identifier>, but it is rejected |
Parameters
-
time - The number of time units
-
timeUnits - One of
seconds
orminutes
-
sender - The phone sending the SMS
-
recipient - The recipient of the SMS
Example
1 2 3 4 5 6 7 8 | Feature: Basic SMS Control Scenario: Sent SMS is rejected Given an Android phone as A And an Android phone as B When A composes a short message And A types "Hello, world" And within 45 seconds, A attempts to send the short message to B.number, but it is rejected |
This Step is eligible for:
- Deferred
Example Test Case: Receive an SMS During a Call ¶
intaQt allows testing SMS usage during an active call. This involves using both voice call Steps and SMS Steps.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Feature: Voice call and SMS Scenario: Send and Receive SMS while talking Given an Android phone as A And an Android phone as B When A dials the number B.number And within 20 seconds, B detects an incoming call from A.number And after 5 seconds, B answers the incoming call And within 5 seconds, A connects When A composes a short message And A types "Hello, world" And within 30 seconds, A sends the short message to B.number And within 30 seconds, B receives a short message from A.number as MYSMS And after 10 seconds, A ends the call and, within 60 seconds, he and B disconnect Then verify !A.isConnected() Then verify !B.isConnected() Then verify MYSMS.text == "Hello, world" |
Example Test Case with Long SMS ¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Feature: Basic SMS Control Scenario: Send and Receive SMS Given an Android phone as A And an Android phone as B When A composes a short message And A types "Hello, world! " And A types "This is the first part of the message" And A types "This is the second part of the message" And A types "This is the third part of the message" And A types "This is the fourth part of the message" And A types "What a beautiful Wednesday morning! " And A types "What a beautiful Thursday morning! " And A types "What a beautiful Friday morning! " And within 30 seconds, A sends the short message to B.number And within 30 seconds, B receives a short message from A.number as MYSMS Then verify MYSMS.text.startsWith("Hello, world") |