Two USSD actions are available in kapptivate Testing & Monitoring:
-
USSD Command
-
Wait USSD Push (only available during test creation, hidden from the remote access interface)
USSD Command
In manual testing
The USSD Command is the first entry in the command choice menu, when you have a SIM card selected:
USSD menu
The interface for this command is straightforward: an input box to type the desired USSD code, a green button to send it (or you can just press Enter).
Remote access interface
The blue, mailbox-like button at the right end of the command area is for getting SMS received by the SIM and is not related to USSD. It is only a shortcut for SMS.
When you have sent an USSD command and received a response, sometimes, in the case of complex menus, you may see some lines with a dashed underline. These are in fact clickable:
Click shortcuts
For instance, if you click 1. French, the code 1 will be sent. It's an alternative way of sending a USSD command without having to type it.
Finally, the USSD responses have a Debug frame that is expandable / collapsible. You can click its title bar to expand it:
Debug frame
In automated tests
Basic options
In automated tests, here is what the USSD Command action looks like:
USSD Command form
- The USSD code input field
- The Expected Message field
- The Execute multiple times field
The Expected Message field is used to write the response that you expect to receive when sending the USSD code. If the response received when running the test doesn't match, the test will fail.
The Execute multiple times option, as its name implies, is used to repeat the same action several times.
Notice the calculator icon above the Expected Message field, on the right:
Character count
It indicates the length of the expected message.
Matching and saving parts of a response
Have a look at the following example:
Dynamic var
The {VARIABLE_1-VARIABLE2} pattern is unique to USSD and SMS actions. The first variable, VARIABLE_1, is used to match a part of the message. It should be a regular expression. In our example, we give to MATCH_TEST the value [a-zA-Z], so that any (lowercase or uppercase) letter will match. If that part of the number contains a number, it will fail.
As of VARIABLE_2, it is the output variable that the matched text will be stored into. It can be a new variable (as in our example), or an existing variable.
Here is what we get when we run the test:
Dynamic var result
During the test execution, after the action completed, the variable FIRST_NAME was set to Sean.
Available assertions
The USSD Command action supports enough assertions to cover all your needs:
Assertions examples
You can run assertions on the response (check its length or its content), on the USSD session status (open, closed, error), on the duration, etc.
Updating an expected message
In the test result, you may notice an Update button next to the expected message:
Update button
This button lets you update the expected message in all tests where it is present:
Update form
It's a handy shortcut if you ever need to change the expected response for many tests at once. However, it's also dangerous, because it will change the expected response for both USSD and SMS actions! So use it with caution.
Wait USSD Push
This action is only available in automated tests. It is very similar to the USSD Command action, the only difference is that instead of sending a USSD code, it just waits to a USSD message on a given SIM card:
Wait USSD Push
The interface is nearly identical to the USSD Command. The only difference is the missing Command field, and an additional option Check USSD push reception from a previous step (if your action is the first step in the test, this option will not appear):
Wait from step
Update a USSD test
If you just need to update an existing USSD test, please refer to the instructions available here.