Skip to content

Automated Functional Testing

Ka-Ping Yee edited this page Sep 10, 2015 · 21 revisions

We use Jenkins, running at jenkins.projectbuendia.org, to automatically build and test 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. Here's how to set up such a node. This procedure has been tested with Ubuntu 14.04.

Logged in as root

  • 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 the command:
    /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

Logged in as 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 -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
  * Select Dumb Slave
  * For **Remote root directory** enter "/home/buendia"
  * For **Labels** enter "android-test"
  * For **Launch method** select Java Web Start

  * 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.
  * 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.
Clone this wiki locally