Home » Activities

Tag: Activities

OutOfMemory Exception with Robotium – Update IV

If you are using Robotium for test automation your Android app and you have many test cases that must be executed, you may run into an OutOfMemory Exceptions after a certain time of test execution.
I have this problem with my test suite. The full test suite consists of around 110 test cases. Besides the full test suite I created a smoke test suite that contains about 40 test cases.
On both suites I get the OutOfMemory Exception no matter which device I use for testing. First I thought, I made some mistakes in my tearDown() method or on the general Robotium setup. But this is not the case. If you call the finishOpenedActivities() method in your tearDown() method, not used activities should be removed and the memory of the device should be freed as well.
I searched on the internet and found the reason for this problem on the official Robotium page. There is currently a bug in the finishOpenedActivities() method.

See the commment from Renas Reda:

“The issue here is that we can not break backward compatibility (getOpenedActivities()). Also this is not only a blackbox test framework, people may be interested in getting a hold of the activities that have been opened. Another reason for the Activity references to be kept is due to being able to finish them at the end. That is needed as having a old Activity still open and in focus will lead to complications with the next test case. Many times activities are not cleaned properly and therfore manually calling finish is a must.
Using weak references could work. I will send you a version where Robotium uses weak references to the Activities instead. Please let me know if it works better for you.”

For more information please check the Issue 249 and watch it ;). It looks likes the problem is already solved and I hope the new Robotium release will available in the next days/ weeks!

Drop me a comment, if you have/had similar problems with your Android testing setup using Robotium.

Update 12. June 2012:
Since 11. June 2012 a new Robotium version 3.3 is released. This new version of Robotium fixed the Issue 249, the OutOfMemory Exception in big projects. Besides that some brand new methods are available for testing.

  • takeScreenshot()
  • clickOnActionBarItem(int resourceId)
  • getCurrentImageViews(View parent)

If you want to use the takeScreenshot() method, the application under test need the following permission in the AndroidManifest.xml android.permission.WRITE_EXTERNAL_STORAGE.

Update II: 14.06.2012

Sadly, the OutOfMemory Exception is not yet fixed. The problem still exists. I am already talking to Renas Reda and try to help him fixing the problem. I will inform you when the bug is fixed!

Update III: 02.07.2012

The problem still exist in the current version of Robotium 3.3. I mailed several times with Renas Reda and he doesn’t know why this is happening. For now, as a workaroung I call the garbage collector manually in my tearDown method. My tearDown looks like this:

public void tearDown() throws Exception {

try {
solo = null;

} catch (Throwable e) {


At least my full testsuite is now running again, without any Out Of Memory Exceptions.

Update IV: 07. August 2012

A new Robotium version 3.4 is out.
http://code.google.com/p/robotium/. In this release the out of memory exception is fixed! Additionally the Robotium team included some really nice new methods like:

scrollToTop(), scrollToBottom(), scrollListToTop(int index), scrollListToBottom(int index), waitForFragmentById(int id), waitForFragmentByTag(string tag), waitForLogMessage(string logMessage), clickOnActionBarHomeButton(), takeScreenShot(string filename)

Have fun!

YAATT – Yet Another Android Testing Tool

Thanks to my colleague @the_qa_guy I got the information that there is another test automation tool for Android Apps. The tool is called bot-bot and provide a selenium like test automation for native Android Apps using a capture & replay functionality.
The tool is developed by Imaginea and based on the keyword driven approach. bot-bot uses the following open source tools:

To provide a capture & replay mode, bot-bot has three different components:

  1. The Recorder: Is responsible for recording the user action on the Android App under test. The recorded actions are send to the Server.
  2. The Runner: Is responsible for the test execution. Also generates html test results.
  3. The Server: Is responsible for tracking the user actions that come from the Recorder. Besides that it give the qa expert the possibility to export the recorded test cases in csv format. The csv file than can be used with the Runner to execute the testcases again.

bot-bot is currently available in the first version 0.7 and provide the following features (List from http://imaginea.github.com/bot-bot/pages/currently.html):

  • Record user actions of any apk file without the need of the source code.
  • Functional testing on any android app for which the apk file is available.
  • Record user actions on simulator or using an actual phone.
  • Store the recorded actions on the server for future refferences.
  • Edit/modify recorded cases.
  • Allow the recorded cases to be exported in csv format
  • Generation of html reports after test execution.
  • Support for extension of test api, for adding or enhancing any existing cases.

The nice thing is, that the qa expert has the possibility to choose between the testing frameworks that is used by the Runner. He can choose between Robotium or NativeDriver!

To get more information check the tool website on github: https://github.com/Imaginea/bot-bot or http://imaginea.github.com/bot-bot/ .
There you find information about How to Install and about the Components.

See how bot-bot works: 

If I get the time, I will setup an environment with bot-bot to check how good the capture & replay function is!

Let me know, if you already have some experience with the tool.

Have FUN!

Useful Android Development/ Testing Tools powered by troido

This week I attended the Mobile Developer Conference in Hamburg/ Germany. In the talk from Miroslav Simudvarac (www.troido.de) he presented some really useful Android Development Tools. I really like the tools and I think they are really helpful for Android Developers or Quality Assurance Experts.

The first tool is the so called re-signer developed by Miroslav Simudvarac. If you want to test e.g. with Robotium against an existing APK file and you don’t have access to the source code, you need to resign the APK file with your own signature. In a previous post I explained why you have to change the signature and how to do this on a commandline. With the re-signer tool you are now able to resign APK files over a graphical user interface. All you need ist the re-sign.jar file and an installed Android SDK. The tool can be downloaded from here. Download the jar file and execute it with a double click or from commandline with java -jar re-sign.jar. The following user interface should show up.

To resign your APK file, just Drag & Drop the file in the window. If the resigning was successful a popup window will show up and give you the information about the starting activity and the package name of the APK file that you need for your Robotium Manifest.xml file. Thats it! Now you should be able to resign APK files even faster!

The second tool is the so called Cert-Checker. Read more

Iqnite April 2012: Talk about Android Test Automation with Robotium

Last week my paper for the iqnite conference 2012 (april) in Duesseldorf was accepted. The talk is about mobile test automation using the tool robotium. The presentation will inlcude facts about robotium and a live Demo Session that show the possibilities of the tool. For more information about robotium check http://code.google.com/p/robotium. Or read a recent blogpost of how to setup robotium http://dnlkntt.wordpress.com/2011/10/29/how-to-setup-a-test-environment-for-android-using-robotium/

Here is the program (sorry, only german version available):


See you in Duesseldorf @iqnite conference!

Robotium 3.0 is out there!

Since November 16th the latest version of Robotium 3.0 is released. This new version of Robotium provides several new and improved methods to test your Android app. As Renas Reda in the jayway blog says: “Robotium is now faster, lighter and more stable then ever!” I hope that is true because the previous versions of Robotium were really slow in the execution, even on real devices. So let’s see what’s new!

The following two methods are new to wait for views:
Read more