In this article we are going to see some tecniques that can be applied in robotium to use it smartly. This is not a complete post, I will add more tips & tricks as the time goes. For basic ideas on robotium, please see my Mobile Testing section. Details , step by steps posts are there.

Sample test template :

I have created two projects for same test case where both are two ways to test same app(one with code, and another is without code). The concept is, there will be a base class maintaining all communication with android test runner. And all test classes will extend that class . All test classes will only contain test methods where as the base class will contain the main android unit test extension , setup, tear down. Here is a screenshot for more details.
Project with source code
Project without source code

How to run Robotium Test Case?
-Run Emulator or device
-Check that the device is connected using "LogCat" /"Device from eclipse or using adb commands in command prompt.  In "LogCat" or"Device", we can see device responses.
-Install debug version of app if you are using apk file to test(no source codes)
-Right click the the package you want to run in side eclipse(or the whole project)
-Select run as Android JUnit Test. If it is not in here, select Run Configuration , and use android junit test.
-Now , we see Emulator activity from log cat and test will be executed. In eclipse, we will see junit runner describing the test progress & results.

Debugging from Emulator and Eclipse : 
- Use "LogCat" and "Device" in eclipse to see app's activity. Spatially what it is doing or interacting. screenshot.
To add "LogCat" or "Device, from eclipse, go to window > show view . You will find device and logcat. If not , click other and you will see full list. Screenshot.
- Try to avoid filter in log cat and use verbose type logcat view so that you can see detail activity of emulator . Spatially test application's activity and responses from android system . If you need to monitor specific activity , then use filter.
- From device, we can do a lot of advance and interesting stuffs like
a. Method profiling : We can see a method's resource using , run time and all other information.
b. Dump View Hierarchy : We can dump view Hierarchy for automated UI tests.
c. Take screenshot : We can take screen shot any time we want. It will help for identifying bugs.
d. Capture system wide trace : be continued...:)