How to turn on robolectric logging

前端 未结 1 769
说谎
说谎 2021-02-13 23:18

I need a very simple way to get Robolectric 3.0 to turn on logging. I want to see the output from robolectric, not just my tests. Everything I tried off the web is not working.<

1条回答
  •  感动是毒
    2021-02-13 23:42

    You can add to your tests:

    @Before
    public void init() { 
        ShadowLog.stream = System.out;
    }
    

    then use: gradle test -i

    Source: Unable to get log.d or output Robolectrict + gradle

    or Add in the build.gradle:

    tasks.withType(Test) { 
         systemProperty "robolectric.logging", "stdout" 
    } 
    

    Source: https://github.com/studyplus/Studyplus-Android-SDK/blob/master/StudyplusAndroidSDK/build.gradle#L41

    0 讨论(0)
提交回复
热议问题