I am having trouble understanding how integration testing is done using android. I went through the documentation and installed my sample project and I can successfully run the tests. However, I am completely confused about how to collect fragments to create my own tests for my own project. I have already completed the integration tests for iOS, and I want to reuse the javascript files that I wrote for testing, however in the sample application it looks like they created new test files ...? In any case, I will explain my probably erroneous understanding, and I would be grateful if someone could help me put everything together.
My understanding is this:
1. A script is called for integration tests, and it runs, checking to see if buck is installed:
set -e 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; }
2. The script calls some method in the gradle assembly that compiles its own code. (Not sure if my gradle script should have the same implementation or be slightly different from this)
echo "Compiling native code..." ./gradlew :ReactAndroid:packageReactNdkLibsForBuck
3. Then the script creates several test suites that include all those tests that the user would like to run. I am not sure where these tests are. Then some conclusion is placed.
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
4. then, using some buck file, the dependencies are downloaded and ready to work, and finally installed on the device. Not sure if I need dependencies or if this file should be fully copied.
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
- The latter runs tests that have been downloaded and compiled.
So, as you can guess from my not very insightful explanation, I am very confused about which files to copy to get something as minimal as my own tests. Any advice or recommendations in this area would be greatly appreciated. the link to the documentation that I might have missed is also in order. Basically, I would appreciate some stream of how these tests are performed, so I can implement a very simple one to extend myself. (so which files should I copy, which files should I change, etc.).