This page is maintained for older versions of Rapise only. The latest documentation can be found at: https://rapisedoc.inflectra.com
Apple iOS

Purpose

 

Rapise lets you record and play automated tests on real iOS devices (iPad and iPhone) as well as test applications using the iOS simulator that ships with XCode. No jailbreaking needed! With Rapise you can record on one device and playback on multiple.

 

Prerequisites

 

This section assumes that you have already installed and configured all of the necessary components. For details on this, please refer to the Technologies - Mobile Testing and Mobile Testing - iOS Setup sections that describes the necessary steps for both physical and simulated devices.

 

Since Rapise runs on Windows computers (PC) and iOS devices (both real and simulated) can only be tested on an Apple Macintosh (Mac) computer, it is necessary that you install Appium and Apple Xcode onto the Mac and connect to Appium over the network from Rapise running on your PC.

 

For Physical iOS devices the architecture looks like:

 

mobile_architecture_ios_device

 

For simulated iOS devices (using the Xcode iOS Simulator) the architecture looks like:

 

mobile_architecture_ios_simulator

 

1) Configure the Mobile Profile

 

To begin mobile testing, when you create the new test, make sure you choose the mobile methodology option "Mobile: Mobile Support":

 

create new test dialog_mobile_selected

 

Once you have entered the name for the new test (with the mobile methodology selected) you will be asked to choose the mobile profile. Rapise ships with several default profiles, for now select the one that is closed to the device you want to test (you can always change it later):

 

mobile_choose_profile_iphone4

 

When you click the [OK] button, Rapise will create a new mobile test with this profile selected.

 

Now you need to modify the profile so that it correctly matches the type of device you are testing and also so that it correctly points to the Appium server that you are using to host the mobile devices. Click on Options > Tools > Mobile Settings to bring up the Mobile Settings dialog box:

 

mobile_settings_dialog_ios

 

The example screeenshot above is for an iPhone 4 physical device running iOS 7.1.1. For any iOS device (real or simulated) you will need to provide the following:

·Uri - this is the URL to your Appium server. We shall discuss this shortly

·app - this needs to the path (on the Mac running Appium) to the Application being tested on the device (e.g. /Users/user.name/Library/Developer/Xcode/DerivedData/AUTiOS-gvdyymxgyzrfgqdfvfylapawjoyd/Build/Products/Debug-iphonesimulator/AUTiOS.app)

·deviceName - this needs to match the name of the device being connected

·platformName - this needs to be set to 'iOS'

·platformVersion - this needs to be set to the correct version of iOS that the device is running

 

In addition, for physical devices only, you need to specify:

·udid - The unique device identifier of the connected physical device (leave blank for simulated devices)

 

Once you have entered in the information and saved the profile, make sure that Appium is running on the Mac (see the Technologies -  Mobile Testing topic for details) and then click the [Test URL] button to verify the connection with Appium:

 

mobile_settings_dialog_ios_success

 

Now you can start testing your mobile iOS application.

 

2) Using the Mobile Spy

 

The Mobile Spy will let you view an application running on the mobile device, take a snapshot of its screen and then interactively inspect the objects in the application being tested. This is a useful first step to make sure that Rapise recognizes the application and has access to the objects in the user interface.

 

To start the Mobile Spy, open the Spy icon on the main Test ribbon and select the Mobile option and the Mobile Spy will be displayed in Discovery Mode. Now click the [Get Snapshot] button to display the application specified in the mobile profile on the screen:

 

spy_dialog_mobile_ios

 

In the example above, we are displaying the sample iOS application that comes with Rapise (AUTiOS).

 

If you click on one objects in the user interface, it will be highlighted in Red and the tree hierarchy on the left will expand to show the properties of that object:

 

spy_dialog_mobile_ios_2

 

If you want to view the contents of the Spy as a text file, just click the 'Page Source' button and you will see the contents of the Spy properties window as a text file. If you want to perform an action on the application (e.g. click on the selected item), switch the ribbon to the ´┐ŻEvents´┐Ż view:

 

ribbon_mobile_spy_events

 

For a full list of the available events and what they mean, please refer to the main Mobile Spy Topic.

 

Assuming that you can see your application in the Spy and that the objects can be inspected (similar to that shown above) you can now begin the process of testing your mobile application.

 

Click on Disconnect to end your Spy session and close the Rapise Spy dialog. You will now will be returned back to your test script.

 

 

3) Recording and Playing a Test

 

With the new Rapise mobile test script open, click on the Record/Learn button in Rapise and that will display the recording activity dialog:

 

recording activity dialog_mobile

 

Now click on the [Pick Object] button and the Rapise Spy will be displayed in Recording Mode:

 

spy_dialog_mobile_ios_3

 

We now want to record a click on one of the menu options, simply highlight one of the menu entries:
 

spy_dialog_mobile_ios_4

 

Now click the [Learn Object] button and the object will be added to the Rapise object tree. Now on the device itself click on the menu entry to go to the next screen, then in Rapise click Get Snapshot to get the updated screen:

 

spy_dialog_mobile_ios_5

 

Now click on some of the objects and choose Learn to add them to the object tree. Once you are finished, click on the Disconnect button. You will see the events in the recording activity dialog:

 

recording activity dialog_mobile_ios

 

Now click on the Finish button and you will be taken back to the test script with the iOS objects listed:

 

object_tree_ios_recording

 

Now that we have the objects, we can drag them into the test script editor and write the following script:

 

//########## Script Steps ##############

 

function Test()

{

 SeSConnectMobile();

 

 SeS('Basic_Controls__Button__TextFiel').DoClick();

 SeS('Username').DoSetText('test user');

 SeS('Password').DoSetText('test pwd');

 SeS('AUTiOS').DoClick();

}

 

g_load_libraries=["Mobile"];

 

This will click on the first menu entry, then enter a username and password and then finally return back to the main menu.

 

Now to playback the test simply click Play in the Rapise test ribbon and the test will play back in the mobile device:

 

report_mobile_ios

 

This is the report of the test being executed.

 

Example

 

You can find the iOS sample tests and sample Application (called AUTiOS) in your Rapise installation at the following locations:

 

Sample iOS Tests:

·C:\Users\Public\Documents\Rapise\Samples\UsingMobile\AppiOS  (testing a native App)

·C:\Users\Public\Documents\Rapise\Samples\UsingMobile\WebiOS (testing a web app)

 

Sample Application  (AUTiOS)

·C:\Users\Public\Documents\Rapise\Samples\UsingMobile\AUT\AUTiOS

 

(we supply the sample application as both a compiled binary and an Xcode project with Objective C source code)

 

See Also

 

·Technologies - Mobile Testing, for instructions on preparing your environment for mobile testing, including instructions for installing the necessary prerequisites and configuring the various third-party components that Rapise uses to connect to the device.

·Mobile Testing - iOS Setup - the steps for setting up XCode for developing and deploying iOS applications