0

[Android] Update android test instructions.

BUG=561837

Review URL: https://codereview.chromium.org/1634043003

Cr-Commit-Position: refs/heads/master@{#371797}
This commit is contained in:
jbudorick
2016-01-27 08:21:56 -08:00
committed by Commit bot
parent 56bbee3b46
commit 9472f11c07

@@ -114,9 +114,11 @@ else, e.g.: `ninja -C out/Release chrome_public_test_apk`
## Running Tests ## Running Tests
All functional tests are run using `build/android/test_runner.py`. All functional tests are run using `build/android/test_runner.py`, either
directly or via a generated wrapper script in `<output directory>/bin/`.
Tests are sharded across all attached devices. In order to run tests, call: Tests are sharded across all attached devices. In order to run tests, call:
`build/android/test_runner.py <test_type> [options]` `build/android/test_runner.py <test_type> [options]`
(or `<generated wrapper script> [options]`).
For a list of valid test types, see `test_runner.py --help`. For For a list of valid test types, see `test_runner.py --help`. For
help on a specific test type, run `test_runner.py <test_type> --help`. help on a specific test type, run `test_runner.py <test_type> --help`.
@@ -130,7 +132,8 @@ out\_android, then do `export CHROMIUM_OUT_DIR=out_android` before running the
command below. You have to do this even if your "out" directory is a symlink command below. You have to do this even if your "out" directory is a symlink
pointing to "out_android". You can also use `--output-directory` to point to the pointing to "out_android". You can also use `--output-directory` to point to the
path of your output directory, for example, path of your output directory, for example,
`--output-directory=out_android/Debug`. `--output-directory=out_android/Debug`. (The generated wrapper scripts handle
this automatically.)
## INSTALL\_FAILED\_CONTAINER\_ERROR or INSTALL\_FAILED\_INSUFFICIENT\_STORAGE ## INSTALL\_FAILED\_CONTAINER\_ERROR or INSTALL\_FAILED\_INSUFFICIENT\_STORAGE
@@ -205,11 +208,10 @@ build/android/test_runner.py junit -s chrome_junit_tests --release -vvv
ninja -C out/Release content_unittests_apk ninja -C out/Release content_unittests_apk
# Run a test suite # Run a test suite
build/android/test_runner.py gtest -s content_unittests --release -vvv out/Release/bin/run_content_unittests [-vv]
# Run a subset of tests # Run a subset of tests
build/android/test_runner.py gtest -s content_unittests --release -vvv \ out/Release/bin/run_content_unittests [-vv] --gtest-filter ByteStreamTest.*
--gtest-filter ByteStreamTest.*
``` ```
## Instrumentation Tests ## Instrumentation Tests
@@ -219,8 +221,8 @@ UNLOCKED. Otherwise, the test will timeout trying to launch an intent.
Optionally you can disable screen lock under Settings -> Security -> Screen Lock Optionally you can disable screen lock under Settings -> Security -> Screen Lock
-> None. -> None.
Next, you need to build the app, build your tests, install the application APK, Next, you need to build the app, build your tests, and then run your tests
and then run your tests (which will install the test APK automatically). (which will install the APK under test and the test APK automatically).
Examples: Examples:
@@ -233,12 +235,8 @@ ninja -C out/Release content_shell_apk
# Build the tests themselves # Build the tests themselves
ninja -C out/Release content_shell_test_apk ninja -C out/Release content_shell_test_apk
# Install the code under test # Run the test (will automagically install the APK under test and the test APK)
build/android/adb_install_apk.py out/Release/apks/ContentShell.apk out/Release/bin/run_content_shell_test_apk [-vv]
# Run the test (will automagically install the test APK)
build/android/test_runner.py instrumentation --test-apk=ContentShellTest \
--isolate-file-path content/content_shell_test_apk.isolate --release -vv
``` ```
ChromePublic tests: ChromePublic tests:
@@ -250,12 +248,8 @@ ninja -C out/Release chrome_public_apk
# Build the tests themselves # Build the tests themselves
ninja -C out/Release chrome_public_test_apk ninja -C out/Release chrome_public_test_apk
# Install the code under test # Run the test (will automagically install the APK under test and the test APK)
build/android/adb_install_apk.py out/Release/apks/ChromePublic.apk out/Release/bin/run_chrome_public_test_apk [-vv]
# Run the test (will automagically install the test APK)
build/android/test_runner.py instrumentation --test-apk=ChromePublicTest \
--isolate-file-path chrome/chrome_public_test_apk.isolate --release -vv
``` ```
AndroidWebView tests: AndroidWebView tests:
@@ -263,37 +257,31 @@ AndroidWebView tests:
```shell ```shell
ninja -C out/Release android_webview_apk ninja -C out/Release android_webview_apk
ninja -C out/Release android_webview_test_apk ninja -C out/Release android_webview_test_apk
build/android/adb_install_apk.py out/Release/apks/AndroidWebView.apk \ out/Release/bin/run_android_webview_test_apk [-vv]
build/android/test_runner.py instrumentation --test-apk=AndroidWebViewTest \
--test_data webview:android_webview/test/data/device_files --release -vvv
``` ```
Use adb\_install\_apk.py to install the app under test, then run the test In order to run a subset of tests, use -f to filter based on test
command. In order to run a subset of tests, use -f to filter based on test
class/method or -A/-E to filter using annotations. class/method or -A/-E to filter using annotations.
Filtering examples: Filtering examples:
```shell ```shell
# Run a test suite # Run a test suite
build/android/test_runner.py instrumentation --test-apk=ContentShellTest out/Debug/bin/run_content_shell_test_apk
# Run a specific test class # Run a specific test class
build/android/test_runner.py instrumentation --test-apk=ContentShellTest -f \ out/Debug/bin/run_content_shell_test_apk -f AddressDetectionTest.*
AddressDetectionTest
# Run a specific test method # Run a specific test method
build/android/test_runner.py instrumentation --test-apk=ContentShellTest -f \ out/Debug/bin/run_content_shell_test_apk -f \
AddressDetectionTest#testAddressLimits AddressDetectionTest#testAddressLimits
# Run a subset of tests by size (Smoke, SmallTest, MediumTest, LargeTest, # Run a subset of tests by size (Smoke, SmallTest, MediumTest, LargeTest,
# EnormousTest) # EnormousTest)
build/android/test_runner.py instrumentation --test-apk=ContentShellTest -A \ out/Debug/bin/run_content_shell_test_apk -A Smoke
Smoke
# Run a subset of tests by annotation, such as filtering by Feature # Run a subset of tests by annotation, such as filtering by Feature
build/android/test_runner.py instrumentation --test-apk=ContentShellTest -A \ out/Debug/bin/run_content_shell_test_apk -A Feature=Navigation
Feature=Navigation
``` ```
You might want to add stars `*` to each as a regular expression, e.g. You might want to add stars `*` to each as a regular expression, e.g.