Running Robotium Test Project using Ant

Pre-Reqs:

– JDK should be installed with JAVA_HOME evnrionment variable set
– Ant – can be found on Apache
–  Working Robotium Test Project, one can find already desinged sample TestProject here
–  Make sure that all required jars are in libs directory and added from build path setting of Eclipse
– Device/emulator should be connected to pc

Lets Start:

1. In Eclipse workspace having testProject, run the following command to set up Ant for the app project:

android update project -p [TestProject Path]

android tool is used to create/update projects, we need to update our exisiting project. it will generate any required files and folders that are either missing or need to be updated.

2. Next step is to link test project with AUT(Application Under Test). Note that the path given to -m must be the relative path to the project under test, seen from the test project, not the workspace:

android update test-project -m [../ProjectPath] -p [Testproject path]

3. To setup library projects

android update lib-project –target “Google Inc.:Google APIs:17” –path [path]

4. Refresh the projects in Eclipse

5. Test if you can build the app project with

ant clean debug

It should come up with “BUILD Successfull” status

6. Run the last command

ant clean debug install test

It will make all necessary installations and run testProject, see the command line for results.