Endtest

Endtest

›Advanced

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

Read SMS

Introduction

In certain scenarios, you might need to check the SMS messages sent by your application.

For example, One-Time Passwords (OTP) are sent to a phone number using SMS (text message) in situations like two-factor authentication.

You can read SMS messages automatically with Endtest, without using any other external service.

This functionality is available for both Web Tests and Mobile Tests and your test does not have to be executed on a mobile device.

This functionality requires real phone numbers to be assigned to your team.

We provide real phone numbers for our users. You don't have to use any external service.

If there are no real phone numbers assigned to your team, you can request one by contacting our Support Team.

This functionality is not related in any way to the phone number that you have provide for the Two-Factor Authentication (2FA) for your Endtest account.

Steps

  1. Make sure there is at least one phone number assigned to your team.
  2. Add a new step with the Real Phone Number option from the Set Variable action.
  3. Choose a name for that variable and add the phone number in the Real Phone Number input.

endtest phone number

All the phone numbers assigned to your team will appear in a dropdown in the Real Phone Number input after you start typing.

You can also find them in the Team section from the Settings page.

  1. The variable declared in the previous step can be used to enter that phone number in any input we want.
  2. Add a new step with the Extract Latest SMS option from the Set Variable action.
  3. Choose a name for that variable.
  4. Enter the name of the variable declared at step 3 in the Real Phone Number input.

endtest sms

You can also enter the phone number directly, but using variables is a good practice.

  1. The text of the SMS will be available in the variable declared at step 7.
  2. You can then use that variable in any step you want, even in assertions.

After the Extract Latest SMS step is executed, the SMS message will be automatically marked as Read and you won't be able to access it with another Extract Latest SMS step.

You can also read and delete SMS messages manually in the Team section from the Settings page.

Extract a value from SMS

In some cases, you might need to extract a certain value from a SMS.

There are 2 ways in which you can achieve that:

1. By using JavaScript

If you are dealing with a Web Test, you can use a Transfer to JavaScript step in order to copy the SMS text from that Endtest variable into a JavaScript variable.

After that, you can use an Execute JavaScript step in order to extract the exact value that you need from that SMS text stored in the JavaScript variable and store it into a separate JavaScript variable.

And then you can copy that extracted value from the newly created JavaScript variable back into an Endtest variable by using the Extract Value from JS Variable option from the Set Variable action.

More details are available in the Execute JavaScript chapter.

2. By using the Endtest Utilities service

We provide an API endpoint called Utilities where you can send API requests during your tests in order to process data.

You can call that API endpoint automatically during your test by adding a Send API Request step.

For example, if you want to extract the OTP from a SMS message, you can use one of the following options: extractNumbersFromText, extractTextBeforePattern or extractTextAfterPattern

More details are available in the Utilities chapter.

← Send API RequestsExecute SQL queries →
  • Introduction
  • Steps
  • Extract a value from SMS
    • 1. By using JavaScript
    • 2. By using the Endtest Utilities service
© Endtest Inc.