Image CAPTCHA
Enter the characters shown in the image.

You are here

Automated Testing of Application on Android using ROBOTIUM – Part 2

Automated Testing of Application on Android using ROBOTIUM – Part 2

Submitted by kkambham on April 26, 2011
Read article at Alliance Global Services

Since my previous blog on automated testing of applications on Android ( Part 1 ), I have been working on various challenges encountered during automation and further refining the approach to create a robust data-driven mobile automation framework with good reporting capabilities.

In this blog, I will be writing about how to setup and configure environment for automated testing of applications on Android starting with setup, creation of the android test project and modifying the manifest.xml file.

The base setup is well documented by following the following links:
Downloading and installing Base ROBOTIUM Framework v2.2
Setting up the environment for Android development with eclipse

I have used Eclipse as my IDE as it is well integrated and documented for Android development. Once we have downloaded the ROBOTIUM framework and setup the eclipse, we need to know the Package/Starter Activity name/Android SDK version details of the application to be tested using Robotium. I have found two approaches to find these details.

Approach 1

At the command prompt enter the command:

C:\> adb logcat

And search for below text:

"Starting activity: Intent {act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER? flg=0x10200000 cmp=com.example.android.notepad/.NotesList "

Target Package: com.example.android.notepad

Starter Activity: NotesList

This gives us the required Package/Starter Activity name details for proceeding with developing automation scripts.

Approach 2

Use re-sign.jar to assign signature for APK File. Open re-assign.jar file and drop the Application APK file. It will remove the existing signature and repacks it as a jar file. Finally it will display the package name and starter activity.

Modify Application Signature
After using re-sign.jar, use java ([jdk1.x]/bin), jarsigner utility to assign new signature (debugkey signature) to the apk created by re-sign utility. Deploy the newly created apk into target device to start with creating automation scripts.

Syntax to use jarsigner utility :
jarsigner -keystore debug.keystore -storepass android -keypass androiddebugkey
Once the prerequisite are known we can proceed with creating an Android JUnit test project in Eclipse.

Create Android Test Project File

To create the test project, open the Eclipse IDE and create AndroidTestProject (File->new->Project->Android->AndroidTestProject). In order to create the test project we need to fill the following details:

TestProjectName : [exampleapplicationtesting]
Test Target : Select “ThisProject“
Build Target : Select this value based on Android SDK version in which the Automation-Under-Test (AUT) was developed.
If the AUT was developed using SDK version 7 then select Android2.1-Update1.
If the AUT was developed using SDK version 8 then select Android2.2.
Properties :
o Application name: [applicationtesting]
o Packagename: [com.test.android.applicationtesting]
o MinSDKversion: Default value will be automatically displayed based on Build Target selection.

Click on “finish” to create the new project with the name [exampleapplicationtesting].

Modifying AndroidManifest.xml

We need to modify manifest file to setup target Application to support various versions of Android SDK.

Default Value in manifest.xml :
[instrumentation android:targetPackage="[com.Example.ApplicationTesting]"]

New value to be entered in in manifest.xml :
[instrumentation android:targetPackage="[Target App package name]"]

We can also specify one additional attribute “android:label”, which will allow us to easily identify the test project in Dev Tools->Instrumentation (as shown in the image below) and execute the automated test from device itself.

If application SDK version is not available then specify the minSDK and maxSDK version to scale test project on multiple SDK versions of the application. The syntax to specify the sdk versions in manifest.xml is:
[uses-sdk android:minsdkversion="3" android:targetsdkversion="7" android:maxsdkversion="9"/]

After doing these modifications save the manifest file. This will complete the basic setup and configuration and get us ready to start creating test scripts using Robotium in Eclipse.


About the author: Kishor Reddy, Associate Test Architect
Associate Test Automation Architect at Alliance Global Services varied experience of 8+ years in STLC – rich experience in Functional Test Automation. Very well experienced in designing Test Automation frameworks, developing test automation solutions for Web, Flex, Flash and Desktop applications and Client-Server applications using QTP and Open-source tools like Selenium, Flex Monkey and Robotium.
View my complete profile

MANUFACTURERS Wallboard

Testing tool manufacturers world-wide list
10Levels ABID CONSULTING AccelQ Accord Software ActiMind AdaCore
AdaLog AgileLoad AgileWay Agitar Algorismi ALL4TEC
Andreas Kleffel Android Apache Apica Apollo Systems AppAssist.mobi
Applitools AppPerfect Appsee ApTest Assertible Assure
Atlassian AutoIt Consulti .. Automation Anyw .. Automation Cons .. Axosoft Aztaz Software
Backtrace I/O Badboy BlazeMeter Borvid BrowserStack BSQUARE
BStriker Intern .. CA Technologies Canonical Canoo Engineeri .. Catch Software CelestialTeapot
Chris Mallett Cleanscape ClicTest CloudQA Codeborne CodeCentrix
CodePlex projec .. Codoid Cogitek Compuware Configure IT Conflair
ConSol Core Services Coronys Ltd Countersoft CresTech Softwa .. CrossBrowserTes ..
Crosscheck Netw .. Crowdsourced Te .. Cucumber Ltd Cyara Cygnet Infotech DareBoost
Databene Datamatics Glob .. DevExpress DTM soft Dynatrace LLC EasyQA
Eclipse EkaTechserv Elvior Emmanuel Jorge Empirix EPAM Systems
Equafy Esterel Technol .. eXept Software .. Experitest Finaris Froglogic
FrontEndART Ltd GeneXus GitHub project gnoso Google Code Pro .. GrammaTech
Gurock Software HelpSystems HENIX Hewlett Packard .. Hexawise High-Tech Bridg ..
Hiptest Hitex IBM Rational imbus Shanghai Impetus Inflectra
informUp InTENSO - IT Ex .. Ipswitch Jamo Solutions Janova JAR Technologie ..
JBoss Developer jClarity Jellly.io JetBrains Jively jQuery foundati ..
JS Foundation Jspresso Kanoah KMS Technology Kualitee LDRA Limited
Litmus LoadFocus Loadster Perfor .. MarathonITE Marketcircle Marketcircle
Maveryx Meliora Ltd Micro Focus Sof .. Microsoft Mobile Labs Mobile1st
Mockaroo, LLC Monkop Mozila MSys Technologi .. Navicat NeoTys
Neowise Softwar .. NetCart NORIZZK.COM Novosync Mobili .. NRG Global NTT Resonant
OC Systems Odin Technology OpCord Oracle Orcanos Original Softwa ..
OW2 PANAYA Parasoft PassMark Patterson Consu .. Perfecto Mobile
Pivotal, Inc. Plutora Postman (API To .. PractiTest PrimaTest Process One
Programming Res .. Psoda PureLoad PushToTest Python Q-Assurance
QA Systems QACube QASymphony QAWorks QMetry Quali
Qualitia Softwa .. Quality First S .. Quotium RadView Softwar .. Ranorex RedLine13
Reflective Solu .. ReQtest RevDeBug Robotium Tech Rogue Wave Soft .. Rommana Softwar ..
RTTS ruby-doc.org Runscope Sandklef GNU La .. Sauce Labs Seapine Softwar ..
SeleniumHQ Sencha Sensiple Siemens PLM Sof .. SmartBear Softw .. SmarteSoft
SOASTA SoftLogica Softomotive Softsmith Solution-Soft SonarSource
Sourceforge Spirent Technol .. SQS Software Qu .. Square Stimulus Techno .. Swifting AB
Synopsys T-komp T-Plan TechExcel TechTalk Telerik By Prog ..
Tellurium Test Collab Test Goat Test Recon TestCaseLab testCloud.de Gm ..
TestCraft Techn .. Testenium Testim.io TestingBot TestLodge Testmunk
Testomato TestOptimal TestPlant TestPro Testsigma Techn .. Testuff
The Core Bankin .. The MathWorks The Open Group thePHP.cc Thoughtbot Thoughtworks
Tigris.org Time Simulator Top-Q Trace Technolog .. TrendIC TRICENTIS
Tritusa Pty Ltd TWD Solutions P .. TypeMock Tyto Software Ubertesters UniTESK
Universal Test .. Usetrace Ltd Utrecht Univers .. Validata Group Vanamco AG Vector Software
Veracode Verifaya Corpor .. Verit VersionOne Viewlike.us Vornex Inc.
Watir.com WcfStorm Soluti .. We Are Mammoth Web Performance .. Wintask Wireshark Found ..
Worksoft Xceptance XK72 Xpand IT XQual ZAPTEST
Zeenyx Software .. Zephyr Zeta Software zutubi pty

Theme by Danetsoft and Danang Probo Sayekti