Skip to content

Running Tests

David Carver edited this page Feb 28, 2015 · 5 revisions

The Andmore project requires a copy of the the Android SDK be available on the system where the tests are running. For the Hudson CI system we use, this is automatically downloaded and installed before a build is run. For running things locally, you will need to create an environment variable called ADT_TEST_SDK_PATH. You can point this to the same location as your ANDROID_HOME environment variable.

export ADT_TEST_SDK_PATH=$ANDROID_HOME

You can get a copy of the Android SDK from http://developer.android.com/sdk/installing/index.html?pkg=tools.

You will need the following API's and Samples installed:

  • API 21
  • API 8
  • API 14
  • API 16

Most tests will use API 16, you also need the build tools, and the platform tools.

If you are trying to run the tests on a CI server, you may need to set the ADBHOST environment variable to point to the local host.

 export ADBHOST=127.0.0.1

The the tests use the complete installation, so ADB needs to be able to be connected too. If you are behind a proxy or a firewall, DDMS may not be able to connect to ADB causing a dialog to appear and block the tests from running.

Speaking of which, their is a small program that runs as part of the tests and it tries to catch any dialogs that pop up and dismiss them to keep the UI tests from hanging. It does a pretty good job, but it may miss some.

For those running on a Linux/Mac the following can be used to help automate the process of downloading and installing the necessary pieces of the SDK you need.

https://gist.github.com/kingargyle/4fbd94837a0efbdb9632

Running from Eclipse

In general you can launch the tests under the org.eclipse.andmore.integration.tests plugin's src folder as regular Eclipse Plugin Tests. If you haven't already you may need to setup the ADT_TEST_SDK_PATH as documented above.

The code that resides under the unittests folder, can be run as either Junit Tests or Eclipse Plugin Tests.

Running from the Maven Build

Just run

 mvn clean install

The tests will be run as normal. Again make sure you have the ADT_TEST_SDK_PATH environment variable setup.

Code Coverage

Code coverage is done use the Jacoco plugin. A report is generated as part of the maven build and resides in:

org.eclipse.andmore.integration.tests/target/jacoco

Skipping Tests

If you want to run a build without running the tests, you can enable the skipTests profile.

 mvn clean install -PskipTests
Clone this wiki locally