diff options
author | dgn <dgn@chromium.org> | 2016-01-21 05:38:57 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-21 13:39:56 +0000 |
commit | 0325c0f7584b37796d7c20e3c9a8c859b3063577 (patch) | |
tree | 35977e296b12bb140c08a10d324045ae96f4faf3 /docs | |
parent | 435741872d39afd2ed06142d4bbdeef2bac6a41e (diff) | |
download | chromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.zip chromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.tar.gz chromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.tar.bz2 |
[doc] logging: explain how to enable it in junit tests
BUG=
Review URL: https://codereview.chromium.org/1581983002
Cr-Commit-Position: refs/heads/master@{#370682}
Diffstat (limited to 'docs')
-rw-r--r-- | docs/android_logging.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/android_logging.md b/docs/android_logging.md index c8404e3..382d2f1 100644 --- a/docs/android_logging.md +++ b/docs/android_logging.md @@ -206,3 +206,23 @@ further. For more, see the [related page on developer.android.com] (http://developer.android.com/tools/debugging/debugging-log.html#filteringOutput) + +## Logs in JUnit tests + +We use [robolectric](http://robolectric.org/) to run our JUnit tests. It +replaces some of the Android framework classes with "Shadow" classes +to ensure that we can run our code in a regular JVM. `android.util.Log` is one +of those replaced classes, and by default calling `Log` methods doesn't print +anything. + +That default is not changed in the normal configuration, but if you need to +enable logging locally or for a specific test, just add those few lines to your +test: + +```java +@Before +public void setUp() { + ShadowLog.stream = System.out; + //you other setup here +} +``` |