Quantcast
Channel: Testing – Falafel Software Blog
Viewing all articles
Browse latest Browse all 68

Preparing Android Devices

$
0
0

Web-based testing has its place, but to work with any part of mobile outside the browser, we need to connect with mobile devices in some way. Your choices are physical devices (smart phones, tablets), emulators, virtual machines, or devices in the cloud. We’ll start with TestComplete setup and then connect a physical Android device.

Before Installing the Mobile Module

Be aware that installing TestComplete Android support requires first installing Java Platform (JDK) and the Android SDK. I have the Java Platform jdk-7u80-windows-x64 installed from here, that goes along with the Android SDK that you can get by installing Android Studio here. If you don’t want the Android Studio IDE, but just want the SDK Tools, look at the Other Download Options section on the same download page. I find the IDE useful for exploring Java source code, creating Android certificates, using emulators, debugging and updating Java Packages.

Setting Up TestComplete

In TestComplete, verify that you have the Mobile module enabled under File > Install Extensions. If you don’t see the Mobile category, re-run the installation to choose it.

The Install Extensions dialog showing Mobile options

Add a button to show TestComplete’s Mobile Screen emulator. First right-click the toolbar and select Customize… from the context menu. Select the Commands tab, the Mobile category and drag Show Mobile Screen to your toolbar. You should also add the Run Mobile Troubleshooter command, just in case.

The Customize dialog with Show Mobile Screen command dragged to toolbar

Connecting a Physical Android Device

To get our feet wet, let’s hook up an Android phone. You will need a USB data cable (not just a power USB cable) to connect the PC that TestComplete runs on to the device.

Note: From a recent forum thread discussing various combinations of device/USB/local machine/remote machine I’ll quote Alex Karas, “Right now TestComplete can access only devices attached via USB to the same machine where TestComplete is running.” Succinct and to the point.

Your device should be visible on the PC in File Explorer, otherwise you’ll need to download and install drivers for your particular device. I’m using a Samsung Note 4 shown below in the File Explorer:

Note: In a weak moment I installed the Verizon tools on the PC running TestComplete. That hasn’t caused problems so far, but you may want to avoid service provider add-on tools if possible. In some cases, providers include their own version of adb.exe (Android Debug Bridge) that TestComplete depends on to talk with the device.

Next, you’ll need to enable Developer options on the phone by clicking the Settings > About Phone > Build number seven times. Developer options will show when you back out of the About Phone screen. In Developer options, enable USB debugging and Stay awake. Depending on your Android version, the location of the options may vary slightly. Check out this reference from the Android developers site for more details.

The Developer options page

Make sure the device is running one of the Android versions listed below. You can check on your device at Settings > About Phone > Android Version. I’m running 5.0.1 for this example.

Code Name Version API Level
Marshmallow 6.0 API level 23
Lollipop 5.1 API level 22
Lollipop 5.0 API level 21
KitKat 4.4 – 4.4.4 API level 19
Jelly Bean 4.3.x API level 18
Jelly Bean 4.2.x API level 17
Jelly Bean 4.1.x API level 16
Ice Cream Sandwich 4.0.3 – 4.0.4 API level 15, NDK 8 (Limitations)
Ice Cream Sandwich 4.0.1 – 4.0.2 API level 14, NDK 7 (Limitations)

Connect your device to the PC running using the USB cable, then click the Show Mobile Screen button. If you get an error “Cannot connect to device with the ID xxx”, then check your steps. Then try the Run Mobile Troubleshooter toolbar command. It has an option to restart ADB (Android Debug Bridge) to get TestComplete talking with your device. When all is well, the Mobile Screen shows up and the Object Browser shows the Mobile node with your device under it. Don’t expect to see any detail under the Device node just yet.

Android device showing in Object Browser Mobile tree

If you look at the Device properties, several are marked as errors with the message “The Android agent is not available on the current device”.

Android Mobile device properties showing errors

It’s a quick fix to click the Enable TestComplete Android Agent… link from the banner on the Mobile Screen. This installs a TestComplete package on the device that populates the Connections, CurrentLocaleName, GPS, and Sensors properties. These properties are available even for image-based tests.

Enabling the TestComplete Android Agent by clicking the Enable link

Wrap Up

In this installment, we configured TestComplete and a single Android device. Next up, we’ll poke at the Mobile Screen a bit. See you tomorrow.

The post Preparing Android Devices appeared first on Falafel Software Blog.


Viewing all articles
Browse latest Browse all 68

Trending Articles