+1 404-214-5804
Enterprise Mobility Blog, Mobile App Testing

Take a Call, Make a Call – Automating Mobile Testing with deviceConnect

Answer Phone scriptMobile Labs Trust delivers a rich, flexible, and high-performance way to automate enterprise apps and mobile websites; such tests are automated with our HP-certified add-in to QTP/UFT.  The experience is rich and flexible because we instrument enterprise apps and websites with the Mobile Labs Agent and AiDisplay.  The agent does not reach outside the app’s boundaries (this is architecturally mandated for both iOS and Google as a way to keep apps from interfering with each other).  While the agent approach is best of breed for testing enterprise apps, sometimes test writers want to interact with device functions (for example, the phone dialer) or built-in apps (for example, messaging).  Fortunately, testers can use deviceConnect’s Airstream app in conjunction with our AiDisplay remote viewer to access such device functions using deviceConnect.  In most cases, this capability is used for manual verification.  Occasionally, testers want to automate such non-app functions. With deviceConnect and UFT 11.5’s Insight Objects, such automation is also eminently possible.

Taking a Phone Call

One of the most popular topics in mobility automation is testing how an app interacts with the device.  Such tests require two things: first, access to the device outside the boundaries of the app (access to the home screen and other phone or tablet functions), and second, automation to drive the relatively simple UI of the device’s built-in apps. Such simplicity normally does not require agent-based testing.  For example, one popular question we receive is “how do I test what my app does when the phone rings?”  A phone takes actions when a call is incoming that are completely out of the control of the app.  Still, to make testing complete, many testers want to prove that their app handles the transition successfully.

Access to the device’s apps and functions can be had remotely with Mobile Labs’ deviceConnect.  For example, for iOS, we supply an app that can remotely view and interact with the device as though it were in the tester’s hands.  This even includes the capability to wake the device and enter a passcode.  Testers can also access messages, calendars, photos, settings (in short, all apps and all functions) and the cellular phone itself.  Later in this post we show how to automate dialing the phone using deviceConnect and UFT 11.5.  Here, we show a simple script that runs when the app being tested is active on the device.  The script uses UFT 11.5’s basic visual-test capability to recognize that the phone is ringing, to answer the call, to terminate the call after a brief period, and then to check to make sure that the app has resumed as expected.

Here is the script:


For i = 1 To 60 Step 1

If MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_Answer_Button”).Exist(1) Then

print “The Phone is Ringing!”


‘Answer the Phone


‘ Wait 5 Seconds

Print “Waiting for 5 seconds. . .”


Print “Now I am going to hang up on’em.”

‘ End the Phone Call



If MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_SignIn”).Exist(5)  Then

MsgBox(“We answered the phone and the app restarted successfully!”)


End If

End If



The script will wait for 60 seconds for the phone to ring, checking once a second.  The incoming call is detected by the presence of the “Answer” icon on the screen (this appears after the app has been backgrounded).  When the icon is detected, the icon is clicked and the phone call is answered.  Once the call is in progress, the script waits 10 seconds and then clicks to terminate the call.  Once terminated, the script then checks to make sure that the expected app page has re-appeared on-screen.  If so, the script puts out a ‘success’ notice and terminates.

The video below shows the script answering a phone call and then verifying that the app screen is correct.

Making a Phone Call

Another question that often comes up is, “Can we automate making a phone call with deviceConnect?”  The following script defines a function that can be called to dial a phone number. The function takes the digits to be dialed as a string and processes the letter “C” as a press of the “Call” button, initiating the call.


Dim a

Set a = CreateObject(“Scripting.Dictionary”)

a.Add “1”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_1”)

a.Add “2”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_2”)

a.Add “3”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_3”)

a.Add “4”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_4”)

a.Add “5”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_5”)

a.Add “6”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_6”)

a.Add “7”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_7”)

a.Add “8”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_8”)

a.Add “9”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_9”)

a.Add “0”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_0”)

a.Add “C”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_Call”)

a.Add “#”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_#”)

a.Add “*”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_*”)

a.add “X”, MobiDevice(“AirstreamConsole”).InsightObject(“InsightObject_X”)



Function phonedialer( digits )


For i = 1 To Len(digits) Step 1

a.Item(Mid(digits, i, 1)).Click


End Function


call phonedialer(“4042817835C”)



The video below shows this script making a phone call.

At Mobile Labs, we make automating your mobile app testing easy. For more info, click the link!

By: Michael Ryan

Michael Ryan

Michael Ryan serves as Mobile Labs’ chief technology officer. In this role, Ryan provides the technological vision and drives Mobile Labs Trust’s product road map. Ryan has more than 35 years of experience in leading software development teams that design and build robust and market-leading solutions for large-scale enterprise customers among Fortune 1000 companies. Most recently, Ryan was with Fundamental Software where he worked on large-scale systems CPU emulation architecture, design, and implementation. Prior to Fundamental Software, Ryan was director of development, Sr. VP of R&D, and finally, Chief Technical Officer for CASE tool vendor KnowledgeWare, Inc. Ryan served as senior staff systems engineer, field manager, and regional technical support manager for mainframe manufacturer Amdahl Corporation.

More Posts - Website

Leave a Reply

You must be logged in to post a comment.

Why Mobile Labs?

Mobile Labs provides enterprise-grade, next generation mobile application testing tools. With a focus on security, agility and affordability, Mobile Labs delivers solutions to help you deliver quality mobile apps for Android, iOS and Windows platforms while also helping manage mobile devices in a private, secure cloud.

Contact Mobile Labs

3423 Piedmont Road NE
Suite 465
Atlanta, GA 30305
+1 404-214-5804
twitter  facebook linkedin google-plus SlideShare