Showing posts with label robotium. Show all posts
Showing posts with label robotium. Show all posts

Tuesday, September 13, 2011

Android, Ant, Emma, Robotium

We started a new android project at work today.  Since there isn't any legacy development we wanted to get it started right, with a continuous integration environment so we wanted to automate the build and testing as an ant task.  I was unable to find anything on the android developer site outlining the process to set this up, so I turned to the internet.  Nothing on the first couple pages of google results had a complete recipe so I figured I ought to share the solution we used.

Requirements
  • Eclipse
  • Android SDK
  • ADT
  • Ant
  • Robotium jar
Create Android Application
  • File -> New -> Other...
  • Open Android -> Select Android Project -> Click Next
  • Set Project name, Android <Version>, Package name (The rest should be filled out with reasonable defaults)
  • Click Finish
Add Ant Script
  • Open terminal to project directory
% $ANDROID_HOME/tools/android update project --path .
Updated local.properties
Added file ./build.xml
Updated file ./proguard.cfg

Create Android Test Application
  • File -> New -> Other...
  • Open Android -> Select Android Test Project -> Click Next
  • Set An existing Android project (The rest should be filled in with reasonable defaults)
Add Ant Script
  • Open terminal to test project directory
% $ANDROID_HOME/android update test-project -m ../BigMeanRobot --path .
Resolved location of main project to: /Users/daya/src/BigMeanRobot/BigMeanRobot
Updated default.properties
Updated local.properties
Added file ./build.xml
Updated file ./proguard.cfg
Updated build.properties

Test Coverage Report
  • Open terminal to test project directory
% ant coverage
...compile/install project...
...compile/install test project...
coverage:
        Running tests...
...cleanup...
  • Open <test project root>/coverage/coverage.html
Add Robotium
  • Download robotium-solo-<version>.jar to <test project root>/libs
  • Add to test project
  • File -> Properties
  • Select Java Build Path -> Libraries -> Click Add Jar...
  • Open Big Mean Robot -> libs
  • Select robotium-solo-<version>.jar -> Click OK
  • Click OK
Create Robotium Test