Monday, November 25, 2013

iOS App Stress testing


Existing android monkey test technique

Android monkey test tool is a just pseudo – random monkey testing tool. It is not android GUI verification tool. It looks for only crashes and ANR by stressing your android application. Re running the same test against with the same configuration will often reproduce the crashes. If you can run the same test configuration on multiple devices (Sony, Samsung, etc..) and different SDKs (4.3, 4.2, 4, 1, 4.0, 3.1, 3.2, etc...), you can be able to catch bugs earlier in the development cycle of a new release.

Android monkey test can execute the below events and below constraints

Events
Touch
Track ball events
Navigation (up/down/left/right)
Sys keys (Home, Back, Start Call, End Call, or Volume controls)
Constraints
Package (-p) - App package name that you need to test ex: com.example.myapp
Category (-c) -  Visit only specific activities that are listed with one of the specified categories


A sample monkey test report out put
Events injected: 1000000
: Dropped: keys=242 pointers=2342 trackballs=234 flips=423
## Network stats: elapsed time=100914ms (0ms mobile, 0ms wifi, 914ms not connected)
// Monkey finished

The same android monkey strategy can possible to apply for iOS applications. iOS Uiautomation instrumentation tool is offering APIs  for pound on our app with a barrage of taps, swipes, device rotations, and even locking and unlocking the home screen. It supports running automated tests in Instruments using JavaScript.
                The same android monkey technique is possible to apply for iOS apps by customizing Uiautomation java script libraries.

A sample Java script test configuration 

config: {
  numberOfEvents: 1000,delayBetweenEvents: 0.05,// In seconds
  eventWeights: {tap: 30,drag: 1,flick: 1,orientation: 1,clickVolumeUp: 1,clickVolumeDown: 1,
    lock: 1,pinchClose: 10,pinchOpen: 10,shake: 1},
 touchProbability: { multipleTaps: 0.05,multipleTouches: 0.05,longPress: 0.05 }},


Ui- Auto-Monkey
Download the dependent java script libraries from: https://github.com/jonathanpenn/ui-auto-monkey/wiki

Installation
There's nothing special to install since this leverages UI Automation and Instruments that come with Apple's developer tools. If you have Xcode, you've got all you need to stress test your applications with UI AutoMonkey. Follow the instructions below to set up a UI Automation Instruments template with the UIAutoMonkey.js script.
First, load up your app in Xcode. Choose "Profile" from the "Product" menu (or press Command-I) to build your application and launch the Instruments template picker.



Next, you'll want to pick the "UI Automation" template. You can add in other instruments to measure the app's performance under the test after we set up the basic automation template.
Switch to the script pane by choosing "Script" from the dropdown menu in the middle dividing bar of the Instruments document.


Create a script in this Instruments document by choosing "Create..." from the "Add" button on the left sidebar.



Paste in the UIAutoMonkey.js script.  At this point you can simply click the playback button at the bottom of the Instruments window to start the script.


Once you've set up UI AutoMonkey in your Instruments document, you can create a custom template tied to this application that you can double click to run. First, make sure the Instruments document is stopped by clicking the red record button in the upper left of the Instruments document. Then choose "Save As Template..." from the "File" menu and choose where to put the file. Now, you can double click this template to open Instruments with the UI AutoMonkey script already embedded. Just click the red record button in the upper left of the Instruments document and the app will launch and run.

Still we need to customize and improve for our needs Ex: Reporting at end of the test that should say crash where in app, what - time, on what event, total time..etc. 

Sunday, October 27, 2013

Android custom view testing and ensure accessibility services is enabled for all custom view ui controls

Generally, Android application developers get accessibility support for free, courtesy of the view and view group classes.

But however, some applications use custom view components to provide a richer user experience. Such custom components won't get the accessibility support that is provided by the standard Android UI components. If tester wants to perform an action on these custom view components, it’s very hard to create an object reference from instrumentation to click, drag or any other actions. Programmatically traversing of custom view classes is not possible. Here instrumentation is very limited until unless developers can provide the methods to perform an action like on click, touch and other stuff.

If this applies to your application, ensure that the application developer exposes the custom drawn UI components to Android accessibility services. Set an each element’s accessibility status and provide custom content for the label for test automation purpose.

Have a look at this video for accessibility service How importance for end mobile users