Rhino runs with some restrictions on android platform. This project builds a very minimalistic app/testframework to run android tests either in an emulator or directly on your phone.
The goal of these tests is to catch over time the kinds of incompatibilities that arise when we use APIs that are not supported on every Android SDK version.
Android developers who want to ensure that specific cases work are encouraged to add new tests to the test case directory:
./it-android/src/main/assets/tests
Write your tests in src/main/assets/tests in the same style as MozillaTestSuite
These are simple javascript tests. (To write java-tests it is recommended to use android-studio.)
This is done automatically on each PR.
You need an Android SDK installed in order for the tests to run
Either install Android-Studio with SDK https://developer.android.com/about/versions/14/setup-sdk
make sure that your ANDROID_HOME enviroment is set up properly
Or, use the provided script in <RHINO_ROOT>/install-android-sdk
This will install the SDK in <RHINO_ROOT>/android-sdk and register it in the local.properties for this gradle build only. (This is the best option, if you do not want to mess up your system)
Note: The script will automatically accept all license terms!
On some environments, you can use <RHINO_ROOT>/run-android-tests-locally.sh to start an emulator in docker/podman, run the tests and install the APK. This test may not work in every case, but is an option on Linux for sure.
This will download an emulator based on https://github.com/budtmo/docker-android and you can access the emulated phone on http://localhost:6080
Note: The emulator will not terminate automatically. You will need to remove it from your docker/podman manually
Once the SDK is installed, you can download Android Studio and use the “Device Manager” in the UI to start an emulator.
Once you have started the emulator, if you run:
./gradlew :it-android:connectedAndroidTest
it will connect to the emulator, install the test app, and run the tests.
./gradlew it-android:connectedAndroidTest will try to run the tests automatically on the connected android device./android-sdk/platform-tools/adb logcat get logs from the device./android-sdk/platform-tools/adb devices list devices./android-sdk/platform-tools/adb disconnect disconnect devices./android-sdk/platform-tools/adb connect localhost:5555 reconnect to emulatordocker rm -f android-container or podman rm -f android-container remove the containerYou need an Android SDK and an Android phone of course. (iPhone will not work here)
wireless debuggingpari device with pariing code./android-sdk/platform-tools/adb pair HOST:PORT PAIRING_CODE./android-sdk/platform-tools/adb connect HOST:PORT (Note: The port is different from the pairing port)./android-sdk/platform-tools/adb devices, if your device is connected./gradlew it-android:connectedAndroidTest to run your tests./gradlew it-android:installDebug to deploy the app on your phone