• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Android Automation Using Robotium
 

Android Automation Using Robotium

on

  • 335 views

This presentation would help give a jump start guide on Robotium for getting started with Android automation should join this Seminar.

This presentation would help give a jump start guide on Robotium for getting started with Android automation should join this Seminar.

Statistics

Views

Total Views
335
Views on SlideShare
322
Embed Views
13

Actions

Likes
0
Downloads
23
Comments
0

1 Embed 13

http://www.slideee.com 13

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Android Automation Using Robotium Android Automation Using Robotium Presentation Transcript

    • Android Automation Using Robotium Presenter : Abhishek Swain, Mindfire Solutions
    • About Me: Abhishek Swain, Software QA Engineer Mindfire Solutions Skills : Robotium , Appium , Selenium WebDriver , Maven , Junit , SQL .... Certifications : ISTQB Foundation Level, V-Skills Selenium Certified Connect Me : Facebook : http://www.facebook.com/jikun55 LinkedIn : http://in.linkedin.com/pub/abhishek-swain/58/8a/829/ Contact Me : Email : abhishek.swain@mindfiresolutions.com /mfsi.abhishek@gmail.com Skype: mfsi_abhishekswain
    • Agenda  Introduction  Features of Robotium  Limitations  Configurations and Creating a project  Discussion on project work flow  Short Demo
    • Short Introduction  Open Source Project hosted under Google code (Source Code : GitHub)  Founder and Developer : Redas Rana (Jayway)  Now Project maintained by Robotium Tech  Basically its a JAVA jar Library containing robust functions  User develops automation scripts using JAVA  Android SDK Library(android.test) provided for testing is used with Robotium
    • What We can do with Robotium: Features List:  Can write Automation scripts for Native as well as Hybrid android applications  Supports Activities, Native Views, Web Views, Toasts and Almost all UI Elements  Can test against Emulators as well as real devices  One script for all versions of Android   Independent of Device screen resolution and Size   Not co-ordinate based, so Robust  Multiple Activities handled automatically
    • Limitations :   No other Client Library supported except Java  No Support for Flash
    • Do we need Source Code ??  Automation Scripts can be written without source code – Complete support for Blackbox Testing  We need the installer build of android platform   i.e apk file  Can also be written if we have Source code – Hence supports Whitebox Testing
    • Requirements :  Android SDK    Download Link: http://developer.android.com/sdk/index.html  Java JDK  Eclipse  Maven  Maven Plugin for Eclipse         Installation Link :http://download.eclipse.org/technology/m2e/releases Installations: 
    • Requirements :  JAVA_HOME  Path of 'bin' directory in System path  ANDROID_HOME Path of 'Tools' & 'Platform-Tools' in System Path  MAVEN_HOME Path of 'bin' directory in System path Configurations/Environment Variables: 
    • Creating Emulators & Configuring Real Device  Emulator:  1. Can be created from 'Android Virtual Device Manager' that is a part Android SDK 2. Can also be created from command line after necessary path settings  Real Devices: 1. Enable USB Debugging from settings in device 2. Connect using micro/mini USB Cable with PC 3. Install necessary drivers for USB debugging according to device manufacturer
    • Re-Signing APK  Signature of both AUT and Test project must match, so Re-Signing necessary  Unsign .apk  Re-sign it with debug.keystore Command : jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore debug.keystore [AUT_name].apk androiddebugkey Default Password: android  Resign Jar Tool can also be used
    • Installing app to Emulators/Device & Some basic commands   Check for connected/available devices adb devices  Install app to Device/Emulator adb install [AUT_name].apk  Uninstall app adb uninstall [application package name]  copy file from PC to Device/Emulator adb push [file_path]/[File_name_with_extension]  copy file from Device/Emulator to PC adb pull [file_path_on_device]/[File_name_with_extension] [folder_path_PC]
    • Creating Android Test Project  Create a new Android Test Project from Eclipse File --> New --> Android Test Project  Convert it to a Maven Project  Add the following Dependency of Robotium to pom.xml        <dependency>             <groupId>com.jayway.android.robotium</groupId>             <artifactId>robotium-solo</artifactId>             <version>5.0.1</version>         </dependency>
    • Configuring Android Test Project  Define Target Package in AndroidManifest.xml  How to get Activity class names of AUT ? From Hierarchy Viewer From Dev Tools - Package Explorer From Logcat
    • Developing Test Script :  Inherit ActivityInstrumentationTestCase2 in the TestClass public Class TestClass_Name extends ActivityInstrumentationTestCase2 Continued..
    • Developing Test Script :  Create instance of Solo class  Define launcher activity class name  Define setUp() and tearDown() methods  Define test methods
    • Understanding Workflow of Android Test Project  Based on Junit - Android Junit Test is the customized version of Junit3  Methods : setUp() and tearDown()  Test Function Naming Convention Must start with keyword 'test' e.g testLogin()  What happens while Executing : Two apk files gets installed : AUT apk and Test Project apk
    • How Android Junit3 Different from Junit4  setUp() and tearDown() take the roles of @Before and @After of Junit4  Test Function Naming Convention Must start with keyword 'test' e.g testLogin()  With Junit4 methods annoted with @Test recognized as test methods
    • Annotations Available with Android Junit Test Project  Most Frequently Used Annotations: @Smoke @SmallTest @MediumTest @LargeTest @FlakyTest(tolerance=n)  To execute a particular Group of test methods annotations are useful  Can be specified while running test from Eclipse and command line
    • How to Target Elements on Activity  By Index e.g solo.enterText(0,"some text");  By Id e.g solo.getView("Id_Of_Element"); solo.enterText((EdiText)solo.getView("Id_Of_Element")," some text");
    • How To Get Ids ??  If we have Source code of AUT, Ids can be identified from code  If we don't have Source Code, Hierarchy Viewer can be used which Comes with Android SDK
    • Robotium Classes and API Definitions  Classes: By Condition RobotiumUtils Solo Solo.Config Solo.Config.ScreenshotFileType Timeout WebElement  API Documentation Link: http://robotium.googlecode.com/svn/doc/index.html
    • Modes Of Running Tests  From Eclipse : As Android Junit Test Annotations, Target Devices can be mentioned in Run Configurations  From CommandLine:  adb shell am instrument -w -e size [small/Medium/Large] Testprojectpackagename/android.test.InstrumentationTestRunner   Particular Classes or Particular Functions can also be specified from command Line  adb shell am instrument -w  -e class [class_name_with_package] Testprojectpackagename/android.test.Instrumen tationTestRunner
    • Support For Build Tools and CI Integration Servers  Can be used with Build Tools like Maven , Ant etc  Android-Maven-Plugin is used to Build with Maven  Can be integrated with Continuous Integration (CI) server like Jenkins/Hudson
    • Demo : 
    • Questions ?? 
    • www.mindfiresolutions.com https://www.facebook.com/MindfireSolutions http://www.linkedin.com/company/mindfire-solutions http://twitter.com/mindfires