Automated Testing Solutions for Android

Posted by Abel Avram on Sep 30, 2011

Sections Development Topics Mobile Tags Android , Automated testing , Test Case , Test Automation , Testing

There are a sort of automatic investigating frameworks or tools for Android applications, including but not restricted to Activity Instrumentation, MonkeyRunner, Robotium, or Robolectric. LessPainful is providing automatic proven on actualised devices as a service.

Android has base hold for arranging tests, digit of the possibilities existence the ActivityInstrumentationTestCase2 collection happiness to the android.test collection and extending JUnit's TestCase in visit to wage useful investigating of Android activities. When an covering is tested, apiece instrumented state is launched exclusive the Dalvik VM on an Android emulator or an actualised device.

The Android SDK comes with a investigating agency titled MonkeyRunner, providing an API and an enforcement surround for streaming tests cursive in Python. The agency has APIs for conjunctive to a device, installing/uninstalling apps, streaming apps, attractive screenshots, scrutiny images to wager if the concealment contains what is questionable to allow after destined commands hit been performed, and to separate a effort collection against an application. MonkeyRunner uses the InstrumentationTestRunner collection to separate tests by impact effort cases with ActivityInstrumentationTestCase2, ProviderTestCase, ServiceTestCase, SingleLaunchActivityTestCase, and others.

Robotium is still added hold that interacts with Android's investigating hold via the InstrumentationTestRunner, providing functional, grouping and espousal tests streaming crossways binary activities. Robotium supports Activities, Dialogs, Toasts, Menus and Context Menus modify for Honeycomb, and it is desegrated with Maven and Ant for streaming constant combining tests. Robotium is kindred to Selenium, but for Android applications.

Robolectric has condemned a assorted path. Instead on relying on Android's investigating functionality provided, this investigating hold uses dominate objects and runs the tests on a lawful workstation/server JVM avoiding dexing, packaging, deploying and streaming the covering proven on an emulator or a actualised device, reaction the instance necessary to action tests. Pivotal Labs claims to be healthy to run 1,047 tests in 28 seconds with Robolectric.

LessPainful has condemned Android investigating a travel further, substance a assist for automatic investigating of applications on binary actualised devices. The individual uploads the covering (*.apk) and a effort enter cursive in Cucumber, a business-readable DSL, selects the organisation of devices he wants the tests to separate on, and then the tests are automatically executed and a inform is generated. The itemize of devices based allow Garmin Asus, individual HTCs, LGs, Samsung Galaxy, Sony Xperia, and Motorola Motodefy.

We hit talked to Jonas Maturana Larsen, CEO of LessPainful, to encounter discover more info most the service. Following is a brief interview:

InfoQ: What problems there are streaming apps on assorted versions of Android? Does a developer requirement to effort his app on every edition of Android to attain trusty that it runs correctly?

JML: One example: The SAXParser on Android before 2.2 has a fault in the asking to ContentHandler.startElement this causes the app to misbehave.

In generalized we hit seen quite a whatever differences between OS versions. Something would break on 2.1-update1 but impact on 2.1-update3 and 2.2.

InfoQ: Is there a actualised Android fragmentation among assorted devices? Can you wage an warning of an covering that runs on Android 2.2 (for example) on HTC and does not separate on a Samsung? (Use whatever compounding of Android edition and figure manufacturers.)

JML: On LG phones HorizontalScrollViews will sometimes drive scenery images on female views to disappear. It occurs on every the LG phones we hit proven and crossways assorted OS versions.

The themes will drive your app to countenance assorted on assorted devices if you don't appendage it yourself. Motorola will, for example, particular an signaling earth with a flushed border. I hit worked on a send where we'd ingest meet the aforementioned flushed abut for exhibit signaling errors.

Other problems are more element attendant than concern related: Some phones with lowercase RAM and a broad partitioning camera will break if you essay to impact an ikon on the phone.

InfoQ: How are tests executed?

JML: The effort is essentially separate as an ActivityInstrumentationTestCase2 and using Robotium. The exclusive change we attain to the covering is to field the mode and depart it.

After the effort has separate the app is uninstalled and the sound settings are brought backwards to default.

InfoQ: What are the advantages of your assist compared to MonkeyRunner, Robotium or Robolectric?

JML: LessPainful is a assist not meet a framework. We poverty to physique a assist that not exclusive makes it doable to effort but does so in a artefact that saves grouping large amounts of instance and helps them encounter more errors than they would if they were using digit of the frameworks.

Another abstract is that we conceive that using Cucumber results in pleasant broad take effort specifications that crapper be mutual right the dev team.

You strength feature that we poverty to be more same github is to git than whatever git accumulation is to git.

InfoQ: Do you organisation on activity more devices in the future?

JML: Yes. We organisation to continually add hold for more devices. If somebody asks for a figure we essay to intend it.

We are currently employed on activity iOS devices too. We wait it to be primed for open beta during the fall.

InfoQ: What is LessPainful Enterprise?

JML: We will wage a box. Most probable it will be a Mac Mini but we are rattling pliant when it comes to client needs. LessPainful Enterprise is currently not an off-the-shelf creation so it rattling comes downbound to what the client is hunting for.

 

 

0 comments:

Post a Comment