Rapise lets you record and play automated tests on real Android devices (e.g. Nexus, Galaxy) as well as test applications using the Android simulator. With Rapise you have the powerful interactive Object Spy that makes it easy to record on one device and playback on multiple.
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 section that describes the necessary steps for both physical and simulated devices.
Rapise runs on Windows computers (PC) and Android devices (both real and simulated) can be tested on either an Apple Macintosh (Mac) computer or a PC:
·If using a Mac, it is necessary that you install Appium and Android Studio onto the Mac and connect to Appium over the network from Rapise running on your PC.
·If using a PC, you can either install Appium and Android Studio onto a separate PC or you can simply use the same PC that is running Rapise. The only difference will be whether the URL used to connect to Appium is a localhost URL or one pointing to the other PC.
For Physical Android devices the architecture looks like:
For simulated Android devices (using the Android Virtual Device Manager) the architecture looks like:
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":
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):
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:
The example screeenshot above is for an Android Nexus7 physical device running Android 4.4.2. For any Android 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/PC running Appium) to the Application being tested on the device (e.g. C:\Users\Public\Documents\Rapise\Samples\UsingMobile\AUT\AUTAndroid\bin\AUTAndroid.apk). If running on the same PC as Rapise, then this path should be already correct.
·deviceName - this needs to match the name of the device being connected
·platformName - this needs to be set to 'Android'
·platformVersion - this needs to be set to the correct version of Android 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/PC (see the Technologies - Mobile Testing topic for details) and then click the [Test URL] button to verify the connection with Appium:
Now you can start testing your mobile Android 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:
In the example above, we are displaying the sample Android application that comes with Rapise (AUTAndroid).
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:
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:
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:
Now click on the [Pick Object] button and the Rapise Spy will be displayed in Recording Mode:
We now want to record a click on one of the menu options, simply highlight one of the menu entries (e.g. "Login"):
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:
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:
Now click on the Finish button and you will be taken back to the test script with the Android objects listed:
Now that we have the objects, we can drag them into the test script editor and write the following script:
//########## Script Steps ##############
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:
This is the report of the test being executed.
You can find the Android sample tests and sample Application (called AUTAndroid) in your Rapise installation at the following locations:
Sample Android Tests:
·C:\Users\Public\Documents\Rapise\Samples\UsingMobile\AppAndroid (testing a native App)
·C:\Users\Public\Documents\Rapise\Samples\UsingMobile\WebAndroid (testing a web app)
Sample Application (AUTAndroid)
(we supply the sample application as both a compiled .apk binary and an Android Studio Java project with source code)
·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.