Last Updated: February 25, 2016
· handtwerk

Re-route Android log output when using Robolectric

By default, the output of Android's Log class is swallowed when tests are run by Robolectric. This can be avoided by setting the robolectric.logging system property. The following alternatives are available:

  • stdout
  • stderr
  • A path to a custom log file

The last option is especially useful for retaining log files, e.g. by dynamically constructing the file name from test name, date, etc.

Have a fresh tip? Share with Coderwall community!

Post a tip