Where is log output written to when using Robolectric + Roboguice?

后端 未结 6 1608
被撕碎了的回忆
被撕碎了的回忆 2021-02-01 13:10

I\'m using Robolectric to test Android. I\'m running my tests via maven, e.g.

mvn -Dtest=LogTest test

If I have code that writes to the logs,

6条回答
  •  鱼传尺愫
    2021-02-01 13:46

    By default, logging output when using the RobolectricTestRunner disappears. You can configure where it goes by looking at the setupLogging() method of that class.

    To summarize, you need to set the robolectric.logging system property to either stdout, stderr, or a file path where the log should be written. I do this in the constructor of a subclass of RobolectricTestRunner that I use for all tests so that logs always get written to stdout.

提交回复
热议问题