-
Notifications
You must be signed in to change notification settings - Fork 36
Automated Functional Testing
Running the functional tests once is straightforward in Android Studio: create a Run Configuration that runs all tests in the androidTest/ directory, then plug in a tablet and click Run.
This page is about how we automate this process using Jenkins. Our Jenkins server at jenkins.projectbuendia.org automatically builds and tests both the client and the server whenever new commits are pushed to GitHub.
Jenkins has a integration-dev
job that runs an integration test by installing the latest server build at integration.projectbuendia.org, installing the latest client build on a tablet, and then running all the functional tests on the tablet, with that client running against that server.
For this job to work, there must be a Jenkins node set up to run these tests—that is, a Linux machine that remains up all the time, communicates with Jenkins, and has an attached tablet.
If you need to add a new node, this is how to do it. This procedure has been tested with Ubuntu 14.04.
-
Install JDK 7 with the command:
apt-get install openjdk-7-jdk
-
Download the Android SDK for Linux ("SDK Tools Only").
-
Go to the
/opt
directory and unpack the tar file you downloaded. -
Install the necessary platform packages with this command (and type "y" to accept the license):
/opt/android-sdk-linux/tools/android update sdk --no-ui --all --filter \ android-21,build-tools-19.1.0,extra-android-support,extras-android-m2repository,platform-tools
-
Add a user named "buendia" with the home directory
/home/buendia
-
Append this line to
/home/buendia/.bashrc
:export ANDROID_HOME=/opt/android-sdk-linux
-
Run
ssh-keygen -t dsa
to generate an SSH key (and don't enter any passphrase, just hit Enter twice) -
Get your key in
.ssh/id_dsa.pub
added to the.ssh/authorized_keys
files for the "jenkins" user on both jenkins.projectbuendia.org and integration.projectbuendia.org. -
Log in to each of those accounts once, answering yes to accept the new host
ssh [email protected] # answer yes, then log out ssh -p 9022 [email protected] # answer yes, then log out
### In Jenkins settings
In a browser, go to http://jenkins.projectbuendia.org/ and log in.
* Click Jenkins > Manage Jenkins > Manage Nodes > New node
* Enter a name for your node
* Select Dumb Slave
* Click OK
* For **Remote root directory** enter "/home/buendia"
* For **Labels** enter "android-test"
* Select "Only build jobs with label restrictions matching this node"
* For **Launch method** select Java Web Start
* Click Save
Then go to the settings page for your newly created node and follow the instructions there to download `slave.jar` and run it on your machine.
### With your tablet
Connect the tablet to your machine with a USB cable and answer the prompt to allow USB debugging.
Now you're all set. Just make sure `slave.jar` is always running. When Jenkins has an Android test job to run, it will launch the job on your machine.
About the software
System Overview
Client Application
Server Application
Server Platform
Development practices
GitHub Usage
Java Style
Testing
Releases
For field users and testers
Software Install and Configuration
Upon Receiving Your Gear
Setting Up a Tablet
Setting Up a Server
Setting Up an Access Point
Reference Configuration