Automating Android Apps using TestComplete (Part-III)
In the previous two TestComplete tutorials, we explored the TestComplete introduction and Data Driven Testing using TestComplete. In this tutorial, we will continue our learning journey by discovering a new feature of TestComplete – how to automate Android apps.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
In this modern era, smartphones play a vital role in our daily lives. With constant advancements in technology and the availability of numerous devices, it becomes a daunting task for developers and testers to ensure their app’s compatibility.
Tools like TestComplete can help increase test coverage and improve test effectiveness. In our previous tutorials, we covered the basic concepts of TestComplete.
In this tutorial, we will cover the following topics:
- What is Android?
- Software required to automate Android apps
- Downloading and Installing Java on the computer
- Configuring Java JDK in Windows
- Download and Installing Android SDK
- Configuring Android in Windows
- Configure Java JDK and Android SDK in TestComplete
- Install Google USB Drivers
- Preparing Mobile Device for testing
- Create Test Project for Android App
- About the Tested App
- How to record our test in TestComplete?
- Analysis of Recorded Test
- Running the Test
- Resolving errors
What You Will Learn:
What is Android?
Android was initially developed by Android Inc., which was acquired by Google in 2005. Android is an open-source operating system mainly designed for touchscreen mobile devices like phones and tablets. It is based on the Linux kernel.
An Android application is a software that runs on the Android platform, which can be a mobile device, tablet, or any other device supporting touchscreen functionality.
Software required to automate Android apps
To automate Android apps using TestComplete, we need to install the necessary software and configure TestComplete accordingly.
Here are the software requirements:
- Java JDK
- Android SDK
- Device USB Drivers
- Android Agent
- TestComplete Mobile Plugins
Now, let’s learn how to install each of the above-mentioned software.
Java JDK
1) Downloading and Installing Java on the computer
- To download Java JDK, click here
- Click on the “Download” button
(Note: Click on any image for an enlarged view)
2) Configuring Java JDK in Windows
After installing Java JDK, it needs to be configured in both the computer and TestComplete. Let’s configure it:
- Right-click on My Computer and select Properties
- Go to Advanced system settings
Android SDK
1) Download and install Android SDK
- Visit this URL
- Scroll down to the bottom of the page
- Click on the download link
2) Configuring Android in Windows
To configure Android in Windows:
- Extract the downloaded Android SDK folder and copy the files to your Local C drive
- Open My Computer and go to Advanced system settings
3) Configure Java JDK and Android SDK to TestComplete
If Java JDK and Android SDK are not automatically configured in TestComplete, we need to set the paths manually. Follow these steps:
- Navigate to Tools | Options
- Go to Engines |Mobile | Android
- Specify the paths for Java JDK and Android SDK
Install Google USB Drivers
To install Google USB Drivers on Windows:
- Connect your Android device to the computer via USB
- Go to Device Manager and select Portable Devices
- Right-click on the device name and select Update Driver Software
- Browse to the folder location C:SDKextrasgoogleusb_driver
- Click Next to install the driver
Preparing Mobile Device for testing
In order to run Android tests with TestComplete, you need to prepare your Android device for testing. Follow these steps:
a) Enable Developer Options on Android Device
- Go to Settings
- Tap on About phone/tablet
- Tap Build number 7 times
- Developer Options will be enabled in the Settings menu
Enable the following options in Developer Options:
1) USB debugging
2) Stay awake
b) Create Test Project for Android App
To create a test project for Android app automation:
1) Select File –>New –>New Project
2) Enter the project name and click Next
3) Select Android Applications and click Next
4) Add the Android application to the project
5) Specify the scripting language and click Finish
About Tested App
In this tutorial, we used a sample Android application provided by SmartBear along with TestComplete. The app is used for managing orders, allowing users to create, modify, and delete purchase orders.
The tested application should be installed on the device used for automated testing.
How to record test in TestComplete?
To record a test in TestComplete:
1) Click on Append to test
2) The recording panel will appear to indicate that the test recording has started
3) Perform the actions in the Android app that you want to record
4) Click on stop recording to finish the recording
Analysis of Recorded Test
After stopping the recording, the keywords generated during the recording will be displayed in the keyword editor. Each keyword corresponds to an action performed in the Android app.
Running the Test
To run the recorded test:
1) Click on the Run Test button
2) The test log will be generated and displayed after the test execution
Resolving errors
If the test fails, there are several possible causes to consider:
1) Third-party applications overlapping the app screen
2) Incorrect initial conditions for the test
3) Incorrectly configured Java JDK and Android SDK in TestComplete
4) Malfunctioning or improperly installed device USB drivers
5) Mismatch between SDK versions and Android device versions
6) TestComplete compatibility with Android versions
Conclusion
This tutorial provided an introduction to TestComplete and how to automate Android apps using it. TestComplete offers a range of features that can be utilized to automate complex systems and frameworks, ensuring effective test coverage.
We hope this TestComplete tutorial series was informative and helpful for you. In our next article, we will explore Robotium – The Most Popular Android Application UI Testing Tool.