How can I show the Log.d() output made in the application code when testing with Robolectric? Currently I use version 2.4.
Asked
Active
Viewed 983 times
0
-
possible duplicate of [Where is log output written to when using Robolectric + Roboguice?](http://stackoverflow.com/questions/10219915/where-is-log-output-written-to-when-using-robolectric-roboguice) – Alex Florescu Dec 03 '14 at 19:05
-
Perhaps a duplicate, but the answers weren't helpful for me. – Dec 03 '14 at 19:08
2 Answers
2
I often doing recently (because of lack integration with Android Studio) next in my test code:
System.out.println("TEST");
And run gradle
with:
gradle testDebug -i

Eugen Martynov
- 19,888
- 10
- 61
- 114
-
I use "gradlew test" to run my tests. What should I do to see any debug output... System.out or Log.d()? – Dec 03 '14 at 19:47
-
First search with "Robolectric + Log" leads tohttp://stackoverflow.com/questions/10219915/where-is-log-output-written-to-when-using-robolectric-roboguice. Did you check it? – Eugen Martynov Dec 03 '14 at 19:52
-
-
I see your comment. So with that solution just run gradle with `-i` flag – Eugen Martynov Dec 03 '14 at 20:08
-
More details here http://www.gradle.org/docs/current/userguide/gradle_command_line.html – Eugen Martynov Dec 03 '14 at 20:10
-
The -i argument works for me, too. Unfortunately my whole app code is cluttered with Log.d() commands. I'm afraid I have to insert additional System.out.println() commands. – Dec 03 '14 at 21:29
1
Put this as a VM argument to your run configuration (in Android Studio):
-Drobolectric.logging=stdout

Frank
- 12,010
- 8
- 61
- 78