Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: docs/android_test_instructions.md

Issue 1421613003: Android: add documentation about junit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/android_test_instructions.md
diff --git a/docs/android_test_instructions.md b/docs/android_test_instructions.md
index 2129cadde9166cfc8effa383f2ec092c745bde4c..ee67bfd569527b9b49b0de9e1f9a42e0d7874ae6 100644
--- a/docs/android_test_instructions.md
+++ b/docs/android_test_instructions.md
@@ -124,7 +124,9 @@ If you build in an output directory other than "out", you may have to tell
test\_runner.py where you place it. Say you build your android code in
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
-pointing to "out_android".
+pointing to "out_android". You can also use `--output-directory` to point to the
+path of your output directory, for example,
+`--output-directory=out_android/Debug`.
## INSTALL\_FAILED\_CONTAINER\_ERROR or INSTALL\_FAILED\_INSUFFICIENT\_STORAGE
@@ -149,6 +151,33 @@ traces, pipe the output through
output directory other than "out", pass
`--chrome-symbols-dir=out_directory/{Debug,Release}/lib` to the script as well.
+## JUnit tests
+
+JUnit tests are Java unittests running on the host instead of the target device.
+They are faster to run and therefore are recommended over instrumentation tests
+when possible.
+
+The JUnits tests are usually following the pattern of *target*\_junit\_tests,
+for example, `content_junit_tests` and `chrome_junit_tests`.
+
+When adding a new JUnit test, the associated `BUILD.gn` file must be updated.
+For example, adding a test to `chrome_junit_tests` requires to update
+`chrome/android/BUILD.gn`. If you are a GYP user, you will not need to do that
+step in order to run the test locally but it is still required for GN users to
+run the test.
+
+```shell
+# Build the test suite.
+ninja -C out/Release chrome_junit_tests
+
+# Run the test suite.
+build/android/test_runner.py junit -s chrome_junit_tests --release -vvv
+
+# Run a subset of tests. You might need to pass the package name for some tests.
+build/android/test_runner.py junit -s chrome_junit_tests --release -vvv
+-f "org.chromium.chrome.browser.media.*"
+```
+
## Gtests
```shell
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698