A couple of weeks ago, I wrote a post about the release of Robotium Recorder. Today I want to show you, how to install and how to use the tool to record your Android tests. This tutorial based on the example Notepad app provided by the Robotium project, the source code can be found here.
Prerequisites & Installation
Before you start with recording, you have to install the Java JDK and the Android SDK. Be sure you have the latest version of the Android SDK installed or updated. If your development environment is up to date, you can import the sample app, provided by the Robotium project. Please follow the instructions in the sample, on how to insert the existing project to eclipse.
If Java, the Android SDK and the sample project is downloaded and installed, start Eclipse and open the Install New Software section in the Help menu (Help → Install New Software). In the input field “Work with” enter: http://recorder.robotium.com/updates and Press the Add… button and enter a name for the installation.
Last week I attended the Eclipse Testing Day 2013 in Darmstadt/ Germany. The main topic of the conference was Mobile Testing. One of the best talks was “Energy testing and optimization of mobile applications” by Claas Wilke. Claas talked about the energy consumption of apps and that this topic is not considered by all developers during the development and testing phase. To prevent apps to consume to much battery, Claas developed a tool called JouleUnit. JouleUnit is an energy profiler, that can be used for Android apps, to find unnecessary battery usage of the app during runtime. JouleUnit is using the Android instrumentation framework to test the app. Beside profiling the battery usage you can also monitor the device CPU, WiFi or the display brightness. JouleUnit tests have the same structure like JUnit tests. At the end of the test run a nice graph is generated to see the battery consumption of the app.
Lint is available as a command line tool and also integrated within Eclipse. I tried the eclipse version and it is very useful! I found several missing translation with it as well as possible performance issues. Check the tool documentation from here to get a really nice overview of the tool: http://tools.android.com/tips/lint
To integrate Lint into Eclipse you also have to update your ADT plugin within the software update section of Eclipse. If the update is done, you get a little icon next to the Android Virtual Device Manager icon. Just select the project you want to check and press the Lint icon.
I really like Lint from a QA perspective, because you can easily check what is going on in the source code and talk to your developers about the findings to improve the app quality!
In the last days I got some questions about how to resign the apk file you want to test. And here is the answer. First some basic about the signatures in Android development! A signature is needed to identify the author of the Android application. A signature mostly contains information like:
This post should show how easy it is, to setup an robotium test environment for Android Apps using the Eclipse IDE. First of all you have to download the latest Android SDK depending to your operating system from http://developer.android.com/sdk/index.html. After downloading the zip file you can unzip it to:
/opt for Linux system
/Applications for Mac OSx systems
c:Programs for Windows systems
AVD – Manager Start the Android avd manager with the command ./tools/android. Read more