Running Android TestCase from device

To test Android application using Robotium we generally make a TestProject containing test cases, during building TestProject, it will be compiled & installed on Device/Emulator as an independent application. We have to connect device with computer to compile and install TestProject.
TestProject application can also be used independently after installing, means install once in device, and then we can run our test iterations without connecting device to computer by simply tapping on installed TestProject app same as we use other applications on device.

We can do this by following simple steps.

Introducing Dev Tools
Dev Tools app is one of Android SDK apps by default installed on emulator, it contains many features which are useful to know more about emulator/device like Connectivity shows details about the device connectivity with Internet, Configuration gives details of device configuration.
For the scope of this tutorial we need to work know about Instrumentation.









Android instrumentation is a set of control methods which control an Android component independently of its normal life cycle. They also control how Android loads applications.To know more about instrumentation please click


On tapping Instrumentation feature, it will load below interface showing android.test.InstrumentationTestRunner. It can run any of the test case classes provided by Android and supports all possible types of testing.
On tapping android.test.InstrumentationTestRunner will run any test case available/installed in device. To know more about android.test.InstrumentationTestRunner please click

We need to install Dev Tools on our device to make our TestProject workable same as other applications.

Get Dev Tools App
We will get Dev Tools installable app from emulator.  From eclipse run emulator and open DDMS interface, it will show the running emulator details in Devices section. Select running emulator and from right side section load File Explorer interface (we can add it by clicking (+) icon at bottom left of eclipse if its not already visible).
File explorer will show emulator file system like below.


Expand the system directory, then app it will show the list of all apps available in file system. Find the Developement.apk file in app directory. Development.apk is installable application name of Dev Tools.  
Highlight Development.apk like below

Now we will get out Development.apk file from emulator & save it on our computer.

Click on pull a file from device from top right of File Explorer interface. It will load interface to save file on computer save it at desired directory.


Install Dev Tools on Device
Connect device with computer and from terminal/command prompt run following command to check device
adb devices

If devices is properly connected to computer it should return device information. If not we may need to install device driver or enable USB Debugging mode from Settings > Applications > Development of device

Run following command to install ‘Development.apk’ file on device
adb -d install /Development.apk

It will show success message after successfully installing Dev Tools.
Now we can see the Dev Tools app installed in our device applications list. Load it and get in to the Instrumentation feature as discussed above.

Install & Run TestProject app
Design your test cases in TestProject right click on TestProject > Run as > Android JUnit Test
It will build TestProject and install it in Device(make sure that device is connected with computer 🙂 ).
After successfully done it, we can find our TestProject installed in
Settings > Applications > Manage Applications
To run TestProject load Instrumentation screen from Dev Tools there should be another android.test.InstrumentationTestRunner visible, Tap on it and stay back it will run our TestProject.

Note: It is also possible to get TestProject app visible in applications list but this is not in scope of this tutorial.