我需要一种非常简单的方法来让 Robolectric 3.0 打开日志记录。我想看到 robolectric 的输出,而不仅仅是我的测试。我在网上尝试的一切都不起作用。
我把这个贴在哪里?
robolectric.logging.enabled = true
我尝试了以下方法:
在 test/java/res 中的 robolectric.properties 文件中
在 test/java/resources 中的 robolectric.properties 文件中
在 test/res 中的 robolectric.properties 文件中
在 test/resources 中的 robolectric.properties 文件中
在 gradle 中:
afterEvaluate {
project.tasks.withType(Test) {
systemProperties.put('robolectric.logging.enable', 'true')
}
}
在 gradle 中:
tasks.withType(Test) {
testLogging.exceptionFormat = 'full'
systemProperties.put('robolectric.logging.enable', 'true')
}
您可以添加到您的测试中:
@Before
public void init() {
ShadowLog.stream = System.out;
}
然后使用:gradle test -i
Source: 无法获取log.d或输出Robolectrict + gradle https://stackoverflow.com/questions/25005667/unable-to-get-log-d-or-output-robolectrict-gradle
或添加到build.gradle
:
tasks.withType(Test) {
systemProperty "robolectric.logging", "stdout"
}
Source: https://github.com/studyplus/Studyplus-Android-SDK/blob/master/StudyplusAndroidSDK/build.gradle#L41 https://github.com/studyplus/Studyplus-Android-SDK/blob/master/StudyplusAndroidSDK/build.gradle#L41
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)