From 113ae202b7d3a03115fe798bc6268c7aebeeab50 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 13 Feb 2014 21:51:29 -0500 Subject: [PATCH 1/3] include Eclipse project for the embedded Android Test Project This should make it easier for some people get started with the tests. --- test/.project | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/.project diff --git a/test/.project b/test/.project new file mode 100644 index 000000000..0c2b67ff9 --- /dev/null +++ b/test/.project @@ -0,0 +1,33 @@ + + + fdroid-test + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + From 9871ad0f014eeb2d99d74ff1e3e24965ba7cc1b0 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 13 Feb 2014 21:53:52 -0500 Subject: [PATCH 2/3] ant-prepare.sh: also set up test suite, should not affect normal ant builds This adds the command to update the embedded Android Test Project, so that it can be run using `cd test/; ant clean emma debug install test` It also changes -p to --path just to make things a little easier to read. --- ant-prepare.sh | 12 ++++++++---- test/ant.properties | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ant-prepare.sh b/ant-prepare.sh index 7817f4ed2..5463a67d5 100755 --- a/ant-prepare.sh +++ b/ant-prepare.sh @@ -1,6 +1,10 @@ #!/bin/bash -ex -android update lib-project -p extern/Universal-Image-Loader/library -android update lib-project -p extern/AndroidPinning -android update lib-project -p extern/MemorizingTrustManager -android update project -p . --name F-Droid +android update lib-project --path extern/Universal-Image-Loader/library +android update lib-project --path extern/AndroidPinning +android update lib-project --path extern/MemorizingTrustManager +android update project --path . --name F-Droid + +# technically optional, needed for the tests +cd test +android update test-project --path ./ --main ../ diff --git a/test/ant.properties b/test/ant.properties index 7d28fd099..836edf047 100644 --- a/test/ant.properties +++ b/test/ant.properties @@ -15,4 +15,4 @@ # 'key.alias' for the name of the key to use. # The password will be asked during the build when you use the 'release' target. -tested.project.dir=/home/pete/code/fdroid/client +tested.project.dir=../ From cdad2c66ed4cfc8c08b593981c484282b8d46b52 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 13 Feb 2014 23:28:31 -0500 Subject: [PATCH 3/3] add instructions for running the embedded Android Test Project --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 2f8893f6e..9c5d1fbbb 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,29 @@ Translate Extension](http://www.mediawiki.org/wiki/Extension:Translate). See [our translation page](https://f-droid.org/wiki/page/Special:Translate) if you would like to contribute. + +Running the test suite +---------------------- + +FDroid client includes a embedded Android Test Project for running tests. It +is in the `test/` subfolder. To run the tests from the command line, do: + +``` +git submodule update --init +./ant-prepare.sh # This runs 'android update' on the libs and the main project +ant clean emma debug install test +``` + +You can also run the tests in Eclipse. Here's how: + +1. Choose *File* -> *Import* -> *Android* -> *Existing Android Code Into Workspace* for the `fdroidclient/` directory. +2. Choose *File* -> *Import* -> *Android* -> *Existing Android Code Into Workspace* for the `fdroidclient/test/` directory +3. If **fdroid-test** has errors, right-click on it, select *Properties*, the +*Java Build Path*, then click on the *Projects* tab. +4. Click on the *Add...* button and select `fdroidclient/` +5. Right-click on the **fdroid-test** project, then *Run As...* -> *Android JUnit Test* + + License -------