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
Requirements
- Eclipse
- Android SDK
- ADT
- Ant
- Robotium jar
- 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
- 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)
- 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
- 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
That still doesn't show how you got your CI to run the robotium tests.
ReplyDeleteGive me a couple days. I'll try to get around to doing a writeup on my setup.
DeleteBasically though:
Linux
- Sun/Oracle Java 6
- Android (Latest)
- Tomcat
- Jenkins
- Hudson Xvnc Plugin
- Hustdon Port Allocator Plugin
- Android Emulator Plugin
- Jenkins Emma Plugin
In the configuration for the particular project:
X - Run Xvnc during build
X - Run Android emulator during build (Setup emulator as you wish, I suggest using snapshots)
# Invoke Ant
Targets: clean emma debug install test
Set path to your build file relative to the workspace.