react-native/scripts/run-android-local-integration-tests.sh
Kevin Lacker affd5ac681 Improve Android testing scripts
Summary:
The goal of this pull request is to make it easier for contributors to run Android tests locally, specifically the unit tests and integration tests. I added a bunch of checks to the local testing scripts that will warn you if your environment is misconfigured, and tell you how to fix it. I also updated the testing docs, so that the regular "Testing" page should be a decent resource to point people to when you are telling them "hey this pull request needs a test." Just Android, though, I haven't gotten to the iOS parts yet.

I also disabled a couple tests that seemed quite flaky while running on a local machine, and don't seem to be providing much value. In particular, the `TestId` test just hangs on my emulator a lot and has been flaky on CI in the past, so I removed about half of its test cases to make the sample app smaller. The testMetions test appears to be dependent on screen size so I commented it out.
Closes https://github.com/facebook/react-native/pull/11442

Differential Revision: D4323569

Pulled By: bestander

fbshipit-source-id: 9c869f3915d5c7cee438615f37986b07ab251f8c
2016-12-13 17:13:35 -08:00

24 lines
914 B
Bash
Executable File

#!/bin/bash
# Runs all Android integration tests locally.
# See http://facebook.github.io/react-native/docs/testing.html
source $(dirname $0)/validate-android-sdk.sh
source $(dirname $0)/validate-android-test-env.sh
source $(dirname $0)/validate-android-device-env.sh
set -e
echo "Compiling native code..."
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
echo "Building JS bundle..."
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
echo "Installing test app on the device..."
buck fetch ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
echo "Running integration tests..."
adb shell am instrument -w com.facebook.react.tests/android.support.test.runner.AndroidJUnitRunner