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

后端 未结 6 1678
被撕碎了的回忆
被撕碎了的回忆 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:39

    Add the following to your test setup before your test runs:

    ShadowLog.stream = System.out;
    Robolectric.bindShadowClass(ShadowLog.class);
    

    https://groups.google.com/forum/?fromgroups=#!msg/robolectric/PK-9cQQQROw/svuQzM5h_vsJ

提交回复
热议问题