⇓ Get Latest Updates ⇓

Enter your email address:



Check email in your inbox for confirmation to get latest updates Software Testing for free.

⇓ Categories ⇓

Netsparker Web Application Security Scanner

Tutorial 6: Android application automation with TestComplete

The TestComplete tool supports the automation testing for Android mobile applications which run on physical Android devices, virtual machines, and emulators. In this article, we are going to learn how to test an Android application using the TestComplete tool. It is expected that at this point you know how to work on the TestComplete IDE. The following are the steps to test Android-based application using TestComplete.
 

Android Application under Test

Suppose that, we need to test an Android-based mobile application which is used to do online Shopping. When you download TestComplete tool, you can find this Android application present at this location on your machine [<TestComplete Samples>\Mobile\Android\Orders]. Before you can start testing using TestComplete this application should be installed on the Android device under test.
 

1) Preliminary Steps:

We have already discussed in the earlier articles of this tutorial series that your machine should have JDK and Android SDK installed on it. Android SDK can be downloaded from below this link [https://developer.android.com/sdk/index.html]. Next step is to install Device USB Drivers. The device USB driver can download from this link [http://developer.android.com/tools/extras/oem-usb.html]. Next, we have to install and configure TestComplete Plugins. After these steps are completed, the tester needs to prepare the device for testing by enabling the developer option on the device under test. After enabling this option to a device, connect the device through USB and verify that it has been connected successfully from your system screen.

 

Android application automation with TestComplete

 

After above setup, the next very important step is to install TestComplete Android agent on your machine. It is a helper application which is used to exchange data between the Android applications prepared for testing and TestComplete tool. When you prepare the Android application for testing you should make sure that the TestComplete tool should recognize objects of an Android application, therefore such necessary preparations are required to be made with the TestComplete tool.
 

2. Creating a Test Project in TestComplete for Android application:

After the preliminary steps are successful then we can work on the creation of the Test project in the TestComplete tool.

  • Close any existing opened project in TestComplete. Navigate to File à New à New Project from the main menu tab of TestComplete. It will open a New Project wizard.
  • In the new project wizard, enter the project name and the location on the system where you want to save the project files as shown below.

 
TestComplete_Create_Project
 

  • Click on the Next button and select the Android Applications as the application type under test.
  • On the next page add the location of the Android project under test present on your system as shown below.

 

Add_Andriod_Application

 

  • Click on the Next button and finish the project wizard in order to complete the Android project creation in TestComplete tool.
  • On the last page, choose the preferred scripting language in which you want to create test automation script for your project.

 

3) Creating a Test in the Test Project:

In TestComplete tool, a test can be created either manually after writing the test in the preferred scripting language or use the record test feature the TestComplete tool depending on the programming skills of the tester.

When you are creating a test manually, you should enter all the required programming commands and actions that you want your test must perform through suitable script objects or keyword test commands. If you have good experience in creating test scripts then this approach will be very helpful in the creation of very powerful and flexible tests which are difficult to capture through recording method in TestComplete. Writing test scripts manually may incur your lots of effort and time in debugging and completing tests respectively as you should know the application object names to work with. The TestComplete tool can help in this area as it has a feature through which it will automatically recognize already performed actions and covert those actions into script lines or operations for keyword test. Such feature is known as “Record a Test” in TestComplete. Such is approach is very useful for novice automation tester as well as it saves lots of time in writing the automation test scripts. We have already covered recording of test scripts automatically in one of the earlier tutorials of this series.

 

TestComplete_Recording

 

4) Analyzing the Recorded Test:

After test recording has finished, TestComplete tool opens the recorded keyword test where it displays test content and enables editing of test contents in the Keyword Test editor. The recorded test scripts contain the programming commands in your preferred scripting language that corresponds to the actions which you have performed on the Android application under test during the test recording. TestComplete tool organizes the test operations in the groups. These groups correspond to mobile devices and stepwise processes which you have worked on the application under test. Grouping of the operations helps to understand the test structure easily and provides information on the object hierarchy present in the Android application under test.

 

Select_device

 

5) Running the Test:

Before running the recorded test, this should be made sure that all the initial conditions that existed during the test recording are maintained as it was before. To run the test, simply hit the “Run test” button as shown below. TestComplete will start executing the commands recorded in the test script and after completion, it will reinstate its windows and display test results. TestComplete also provides the pause button while the test execution. The pause button will pause the test and allows you to perform any action if needed.

 

TestComplete_RunTest

 

6) Analyzing Test Results:

The TestComplete maintains a complete log which covers all operations which were performed during testing. You can observe these links to test results in the Project Explorer panel under the Project Suite Logs à“Project Name” Log node. Here, you can also lookup the test history of the project and the project suite. Here, each node relates to a test run where an image present at the left of the node specifies whether that test has executed successfully or failed.

Conclusion:

In this article, we discussed the preparation and testing of the Android application under test through TestComplete tool.

 
If you are not a regular reader of this website then highly recommends you Sign up for our free email newsletter!! Sign up just providing your email address below:

Enter your email address:

Check email in your inbox for confirmation to get latest updates Software Testing for free.

 
Happy Testing!!!
 

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>