forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scripts for running tests locally
Summary: I was going to add an integration test and realized it would be useful to have an easy way to run these test locally. Added scripts and documented how to use them. **Test plan** `./scripts/run-android-local-unit-tests.sh` <img width="786" alt="screen shot 2016-05-04 at 3 55 26 pm" src="https://cloud.githubusercontent.com/assets/346214/15018667/7f4981cc-1212-11e6-9fcb-12493c29015c.png"> `./scripts/run-android-local-integration-tests.sh` <img width="772" alt="screen shot 2016-05-04 at 3 57 23 pm" src="https://cloud.githubusercontent.com/assets/346214/15018677/90b54810-1212-11e6-83d4-58530eb41d79.png"> Buck check by replacing `which buck` by `which duck` in the scripts: <img width="805" alt="screen shot 2016-05-04 at 4 09 37 pm" src="https://cloud.githubusercontent.com/assets/346214/15018696/aa008262-1212-11e6-9a22-173507cd771f.png"> Checked the website renders fine: `cd website; npm install; npm start` . | ||
See the [docs on the website](https://facebook.github.io/react-native/docs/android-building-from-source.html). | ||
|
||
# Running tests | ||
|
||
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see [Testing](https://facebook.github.io/react-native/docs/testing.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# Runs all Android integration tests locally. | ||
# See http://facebook.github.io/react-native/docs/testing.html | ||
|
||
which buck > /dev/null || { | ||
echo "React Native uses the Buck build tool to run tests. Please install Buck: https://buckbuild.com/setup/install.html"; | ||
exit 1; | ||
} | ||
|
||
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 install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests | ||
echo "Running integration tests..." | ||
./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Runs all Android unit tests locally. | ||
# See http://facebook.github.io/react-native/docs/testing.html | ||
|
||
which buck > /dev/null || { | ||
echo "React Native uses the Buck build tool to run tests. Please install Buck: https://buckbuild.com/setup/install.html"; | ||
exit 1; | ||
} | ||
|
||
echo "Fetching dependencies..." | ||
buck fetch ReactAndroid/src/test/... | ||
echo "Running unit tests..." | ||
buck test ReactAndroid/src/test/... |