android session

Upload: adichourasiya

Post on 06-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Android Session

    1/33

  • 8/2/2019 Android Session

    2/33

    First of all, you need practical Android environment experience as weare not covering the basics. It is assumed that you already have usedsome Android application or at least you are familiar with mobileapplications and windows OS.For more reading reference go to http://developer.android.com

    Some part of this presentation may be a copyright content henceredistribution is not advised.

    What we need is a Win32/64 machine with at least 600MB free space. Java SE Environment setup Android SDK setup

    Android device/Specification on which Application is to be tested Data cable and USB driver for particular android device Application to test

    http://developer.android.com/http://developer.android.com/http://developer.android.com/
  • 8/2/2019 Android Session

    3/33

    Hi Everyone, We will start with a general revision and later on move tothe concepts and techniques closely related to the Android platform.

    QA/Testing is an investigation conducted to provide stakeholders with

    information about the quality of the product or service under test.Software testing provides an objective, independent view of the softwareto allow the business to appreciate and understand the risks of softwareimplementation. Test techniques include, but are not limited to, theprocess of executing a program or application with the intent of finding

    software bugs (errors or other defects).Software testing can be stated as the process of validating andverifying that a software program/application/product meets therequirements that guided its design and development; works asexpected; and can be implemented with the same characteristics.

    Mobile-application testing is the same process to assure thequality of mobile applications running on mobile phones, PDAs, etc. Thetesting is conducted on both hardware and software.Mobile-device testing involves a set of activities from monitoring and

    trouble shooting mobile application, content and services on realhandsets. Testing includes verification and validation of hardware

    requirements and software applications.

  • 8/2/2019 Android Session

    4/33

  • 8/2/2019 Android Session

    5/33

    What is Android ?Open source platform for mobile devices,A complete software stack

    >>OS >>Middle-ware >>ApplicationsBased on Java

    '

  • 8/2/2019 Android Session

    6/33

    Android Testing History :

    Initially, when Android was introduced by theend of 2007, there was very little support fortesting on the platform, and for some of usvery accustomed to using testing as a componentintimately coupled with the development process,it was time to start developing some frameworks and tools to permit this

    approach.By that time Android had some rudimentary support for unit testing usingJunit (http://www.JUnit.org), but it was not fully supported and even lessdocumented. Android Testing Environment provides different conditionsto run the tests. It starts with the creation of the Android Virtual Devices(AVD) to provide different conditions and configurations for the

    application under test and runs the tests using the available options.Finally, it introduces monkey as a way to generate simulated events usedfor testing.

  • 8/2/2019 Android Session

    7/33

    Physical characteristics of the device:Well before delivering your application you should be sure that all of thedifferent devices it can be run on are supported or at the least youshould detect the situation and take appropriate measures.

    Among other characteristics of the devices, you may find that you shouldtest:Network capabilitiesScreen densitiesScreen resolutionsScreen sizes

    Availability of sensorsKeyboard and other input devicesGPSExternal storage

    In this respect Android Virtual Devices play an important role because itis practically impossible to have access to all possible devices with all of

    the possible combinations of features but you can configure AVD foralmost every situation.However, as was mentioned before, save your final testing for actualdevices wherereal users will run the application to understand itsbehavior.

  • 8/2/2019 Android Session

    8/33

    Types of Android Tests:Testing can be implemented at any time in the development process,depending on the method employed.

    Unit tests

    Unit tests are software tests written by programmers for programmers in aprogramming language and they should isolate the component under testand be able to test it in a repeatable way.

    Android (up to Android 2.3 Gingerbread) uses JUnit 3 . This version doesn'tuse annotations and uses introspection to detect the tests.

    Eclipse and other IDE support:JUnit is fully supported by Eclipse and the Android ADT plug-in lets youcreate Android testing projects. Furthermore, you can run the tests andanalyze the results without leaving the IDE. This also provides a more subtleadvantage; being able to run the tests from Eclipse allows you to debug thetests that are not behaving correctly. The name of each test and its duration

    is also displayed. If there was a failure, the Failure Trace would show therelated information. Other IDEs like ItelliJ and Netbeans have pluginsintegrating Android development to some degree but they are not officiallysupported.Even if you are not developing in an IDE, you can find support to run thetests with ant (check http://ant.apache.org if you are not familiar with this

    tool).

  • 8/2/2019 Android Session

    9/33

    Performance tests:Performance tests measure performance characteristics of the componentsin a repeatable way. If performance improvements are required by somepart of the application, the best approach is to measure performance

    before and after some change is introduced.As is widely known, premature optimization does more harm than good,so it is better to clearly understand the impact of your changes on theoverall performance.

    The introduction of the Dalvik JIT compiler in Android 2.2 changed someoptimization patterns that were widely used in Android development.

    Nowadays, every recommendation about performance improvements onthe Android developer's site is backed up by performance tests.

    System testsThe system is tested as a whole and the interaction between thecomponents, software and hardware, is exercised. Normally, system testsinclude additional classes of tests like:

    GUI testsSmoke testsPerformance testsInstallation tests

  • 8/2/2019 Android Session

    10/33

    Android SDK Installation:First install Java SDK/ Java Enviornment from Java website.Android SDK can be easily downloaded From

    http://developer.android.com.

    - Extract the SDK and Install it in the following manner:Copy the path till tools folder where we can see the Emulator,DDMS, adb etc.

    http://developer.android.com/http://developer.android.com/
  • 8/2/2019 Android Session

    11/33

    Now, Go to Start menu

    -> My Computer-> Right click -> Properties

    It will generate System properties Window.

    Now, Click on Environment Variables.

  • 8/2/2019 Android Session

    12/33

    Under Environment Variables

    -> System Variables -> Path

    Click Edit and give the Path till tools folders.

    Click OK to Finish Installation of SDK.

  • 8/2/2019 Android Session

    13/33

    Preparing device for installation of the Application

    From the Main Menu select

    Settings ->Applications->Unknown Sources

    Also Check the box ahead of USB debugging.

    When you check the box ahead of Unknown Sources a pop-upmessage will b displayed which is as follows.

    Click Ok and connect device to PC using datacable.

    Connect the device to computer inUSB Debugging mode.

    Install Drives for device.

    [Note : Alternate to this we can also create avirtual machine [emulator] by proceduredescribed on pages ahead.]

  • 8/2/2019 Android Session

    14/33

    To create AVD you use android from the command line or even from insideEclipse using Windows | Android SDK and AVD Manager or its shortcut icon.Running the command you access the Android SDK and AVD Manager whereyou press the New... button to create a new AVD, and this dialog box ispresented:

  • 8/2/2019 Android Session

    15/33

    The properties that can be set in AVD are:

    >Camera support : Boolean : Whether the device has a camera or not.>Cache partition size integer The size of the cache partition.>SD Card support : Boolean : Whether the device supports insertion andremoval of virtual SD Cards.>Cache partition support : Boolean : Whether the cache partition issupported. Usually this partition is mounted in /cache.>Keyboard support :Boolean : Whether the device has a physical QWERTY.>Audio playback support : Boolean : Whether the device can play audio

    >Audio recording support : Boolean : Whether the device can record audio.>Track-ball support : Boolean : Whether there is a trackball on the device.>Maximum horizontal camera pixels integer The maximum horizontaldimension in pixels of the virtual camera.>DPAD support : Boolean : Whether the device has DPAD keys.>Maximum vertical camera pixels integer The maximum vertical dimension

    in pixels of the virtual camera.>Accelerometer : Boolean : Whether the device has an accelerometer.>GPS support : Boolean : Whether the device has a GPS.>Device RAM size integer The amount of physical RAM on the device. Thisis expressed in megabytes.

  • 8/2/2019 Android Session

    16/33

    >Touch-screen support : Boolean : Whether there is a touch screen onthe device.>Battery support : Boolean : Whether the device can run onbattery.>GSM modem support : Boolean : Whether there is a GSM modem inthe device.

    After pressing start. to start the AVD you can select other properties:> Screen Size>Monitor DPI

    > Wipe User Data

    An AVD [Emulator] can look like this :

    Installing the Application:

  • 8/2/2019 Android Session

    17/33

    Installing the Application:

    Run the command adb devices. This will list out the devicesconnected.Once you get the device you want to install application on, then run the

    command adb -s install wheredevice is the name of the device that was shown at the previouscommand & application.apk is the name of the APK file.

    Once the application is installed, it can be found in the main menu.Touninstall the application go to the Main Menu -> Settings -> Applications -> Manage Applications -> -> Uninstall

  • 8/2/2019 Android Session

    18/33

    Other mode of installation could be1. OTA [wifi or operator] : Upload and download the build using devicebrowser.2. Data cable mass storage mode: On higher Versions.3. Memory card/Bluetooth/IR : This required some file manager softwareinstalled in lower android versions.4. Android market place : For live builds.

    Additional Assets Download Requirements:Some Android builds require that the user download additional files oncethe application has already been installed. Upon first launch, theapplication will prompt the user that it must download more files in orderto play the game. If the user accepts, the application will download allthe additional files required to play, and then launch immediately once it

    is done. The application cannot be launched without that specific SDcard present in the device, and the assets that are downloaded will notwork on another device, even if the same SD card is placed inside.

    Ch i Ski f l t

  • 8/2/2019 Android Session

    19/33

    Changing Skins of emulatorThere are four types of default skins available for android emulatorHVGA-L 480x320, landscapeHVGA-P 320x480, portrait (default)QVGA-L 320x240, landscapeQVGA-P 240x320, portrait1. Run cmd and type path to tools folderEg: cd d:\android\tools2. Type emulatorskin E.g: emulatorskin QVGA-LQVGA 240 X 320

    Creating a SDCARD for emulator3. Run cmd and type path to tools folderEg: cd d:\android\tools4. Type mksdcardl K/M Eg: mksdcardl SD1GB 1024M sdcard.iso

    Inserting and SDCard in to the emulator1. Open cmd and type path to tools folder

    Eg: cd d:\android\tools2. Type emulatorsdcard

    Eg: emulatorsdcard sdcard.iso

  • 8/2/2019 Android Session

    20/33

    One thing that we may have noticed running AVDs is that theircommunication ports are assigned at runtime, incrementing the last usedport by 2 and starting with 5554. This is used to name the emulator andset its serial number, for example, the emulator using port 5554 becomes

    emulator-5554. This is very useful when we run AVDs during thedevelopment process because we don't have to pay attention toport assignment. But it can be very confusing and difficult to track whichtest runs on which emulator if we are running more than onesimultaneously.

    The command line to launch the test AVD we just created would be:$ emulator -avd test -no-window -no-audio -no-boot-anim -port 5580 &The port must be an integer between 5554 and 5584:

    To check attached android devices to pc:On command line type : adb devices

    Once we have finished working with one of the headless emulatorinstances, we started using the command mentioned before. We use thefollowing command line to kill it:$ adb -s emulator-5580 emu kill

  • 8/2/2019 Android Session

    21/33

    Dalvik Debug Monitor Service [DDMS]

    Run Dalvik Debug Monitor Service from tools of Android SDK>tools or

    From command prompt type DDMS and hit enter.A window will open where you can see the connected device.

  • 8/2/2019 Android Session

    22/33

    Note that you can use this tool for multiple connected devices andemulators.Now launch any application on the device or emulator.Select the device on the Dalvik Debug Monitor.

    Press Ctrl +S to open the Device Screen Capture window.Click on save to save the image.The format of the image is .png, which can be changed to JPEGafter opening it in paint.

    Use refresh to capture the images which reflect the current screenin the application.

    Observe that Logs can also be generated from this tool. Otherdevelopment related info can also be gathered from same.

    Monkey:

  • 8/2/2019 Android Session

    23/33

    Monkey:

    You may know about the infinite monkey theorem.The Android version of this theorem states that a monkey producingrandom touches on a device could crash your application in, well... much

    less than an infinite amount of time.In this line, Android features a monkey application(http://developer.android.com/guide/developing/tools/monkey.html) thatwould generate the random events instead of a real monkey.The simplest way to run monkey against our application to generaterandom events is:$ adb -e shell monkey -p com.example.aatg.tc -v -v 1000

    And you will be receiving this output:Events injected: 1000:Dropped: keys=0 pointers=0 trackballs=0 flips=0## Network stats: elapsed time=100914ms (0ms mobile, 0ms

    wifi, 100914ms notconnected)// Monkey finishedThis displays the details of the events injected through monkey.The monkey will send events only to the specified package (-p), in thiscase com.example.aatg.tc, in a very verbose manner (-v -v). The count of

    events sent will be 1000.

  • 8/2/2019 Android Session

    24/33

    Example of 3rd Party Monkey Test Criteria:

    Ex. Commandadb shell monkey -p com.esmertec.android.jbed --throttle 100 -v 50000

    -p

    --throttle

    -v 50000 (~30 minutes)

    Required Screen shot of Monkey test result which including

    Sending event number 49900 (last 100 event wont be shown)

    Package name under test

    Monkey finished message

  • 8/2/2019 Android Session

    25/33

  • 8/2/2019 Android Session

    26/33

    Global options:-v --verbose Verbose mode: errors, warnings and informational

    messages are printed.-h --help Help on a specific command.-s --silent Silent mode: only errors are printed out.

    Action "create test-project":Creates a new Android project for a test package.

    Options:-p --path The new project's directory [required]-m --main Path to directory of the app under test, relative to thetest project directory [required]-n --name Project name

    As indicated by the help you should provide at least the path to the

    project (--path)and the path to the main project or the project under test (--main).

    Test targets

  • 8/2/2019 Android Session

    27/33

    During the evolution of your development project your tests would betargeted to different devices. From the simplicity, flexibility, and speed oftesting on an emulator to the unavoidable final testing on the specific

    devices you intend your application to be run on, you should be able torun on all of them.There are also some intermediate cases like running your tests on a localJVM virtual machine on the development computer or on a Dalvik virtualmachine or Activity, depending on the case.Every case has its pros and cons, but the good news is that you have all

    of these alternatives available to run your tests.The emulator is probably the most powerful target as you can modifyalmost every parameter from its configuration to simulate differentconditions for your tests. Ultimately, your application should be able tohandle all of these situations, so it is much better to discover theproblems upfront than when the application has been delivered.

    The real devices are a requirement for performance tests, as it issomewhat difficult to extrapolate performance measurements from asimulated device. You will discover the real user experience only whenusing the real device. Rendering, scrolling, flinging, and other casesshould be tested before delivering the application.

    Test Critarias :

  • 8/2/2019 Android Session

    28/33

    1 Install and Launch1.1 OTA install1.2 Long Launch Time

    2 Memory Use2.1 Memory during run

    3 Connectivity :3.1 Invalid web access setup

    3.2 Send/receive data3.3 Network delays and loss of connection3.4 Network connectivity Airplane mode

    4.1 Messaging auto start4.2 Message queuing

    4.3 Timed event expiry4.4 Timed event expiry during suspend4.5 Timed event expiry during application exit

    5 Messaging & calls:

  • 8/2/2019 Android Session

    29/33

    5 Messaging & calls:5.1 Send

    5.2 Receive

    5.3 Incoming call

    6 External Influence6.1 Memory card insertion6.2 Memory card insertion and removal

    6.3 Memory card screen behavior

    7 User Interface

    7.1 Readability7.2 Read time7.3 Screen repainting7.4 Consistency7.5 Key layout ease of use7.6 Application speed7.7 Error messages

    7.8 Function progress7.9 Actions while rendering7.10 Multiple display format handling7.11 Differing screen sizes7.12 Multiple format input handling7.13 Accelerometer/motion sensor responses7.14 Spelling errors

    7.15 Technical text errors 8.Language

  • 8/2/2019 Android Session

    30/33

    8.1 Correct operation8.2 Manual selection8.3 Supported formats8.4 International characters

    9.Performance9.1 Suspend/resume from main menu9.2 Suspend while executing9.3 Resume9.4 Influence on terminal system features

    9.5 Resource sharing - database

    10.1 Application mute option10.2 Settings statuses understandable10.3 Settings do not impair application10.4 Settings combinations

    10.5 Saving settings10.6 Specific functions

    11 Menu11.1 Help and about11.2 Valid actions

    12 Functionality

  • 8/2/2019 Android Session

    31/33

    12 Functionality12.1 Functionality sanity check12.2 Application hidden features

    13 Keys

    13.1 Scrolling in menus13.2 Selection key13.3 Text field scrolling13.4 Pause13.5 Simultaneous key presses13.6 Multi key presses

    14 Device Specific Tests14.1 Device close14.2 Device open

    15 Stability

    15.1 Application stability15.2 Application behavior after forced close

    16 Data Handling16.1 Save game state16.2 Data deletion16.3 Modify record

    17 Security

  • 8/2/2019 Android Session

    32/33

    17.1 Encryption17.2 Passwords

    Few Testing Tips for Android:Android application will have .apk extension, this is extractable.

    There should not be any initial Sound prompt.

    Volume toggle keys must be functional for Volume control Only, with volume bar

    display.

    Menu must be stack as per device Shell.

    Application should be completely touch enabled.

    Application should work in portrait as well as landscape mode.

    Touch area is thumb size standard.

    Native Android can work on multiple resolution.

    Monkey is not mandatory, but can be when external critaria..........and so on.

  • 8/2/2019 Android Session

    33/33

    Imagination is more important than knowledge.

    -Albert Einstein

    Sources :www.Developer.Android.com

    Google

    Android Application Testing Guide

    By Diego Torres Milano

    Automating GUI Testing for Android ApplicationsBy Cuixiong(Tony) Amazon Inc. ,

    Hu Iulian Neamtiu, University of California, Riverside

    Unified Testing Criteria for Androidapplicationsversion 1.0: March 2011

    http://www.brainyquote.com/quotes/quotes/a/alberteins129815.htmlhttp://www.developer.android.com/http://www.developer.android.com/http://www.developer.android.com/http://www.brainyquote.com/quotes/quotes/a/alberteins129815.html