要在Firebase测试实验室catlog中显示的JUnit日志消息



我正在使用Flank/Firebase Test Lab针对Android API28设备运行JUnit4测试,并且我从测试监听器打印的日志消息都没有打印在设备的catlog中。

我尝试了一些东西:

尝试1

println("===TEST")

尝试2

import android.util.Log
Log.e("UnitTest", "===TEST MESSAGE")

尝试3

bundle = Bundle()
bundle.putString(Instrumentation.REPORT_KEY_IDENTIFIER, MyTestListener::class.java.name)
bundle.putString(InstrumentationResultPrinter.REPORT_KEY_NAME_CLASS, description.className)
bundle.putString(InstrumentationResultPrinter.REPORT_KEY_NAME_TEST, description.methodName)
bundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, "=== TEST_FINISHED")
InstrumentationRegistry.getInstrumentation().sendStatus(InstrumentationResultPrinter.REPORT_VALUE_RESULT_OK, bundle)

这些方法似乎都没有在catlog输出中包含我的日志。。。但是我可以看到我的测试用例已经运行并通过了。有人有什么建议吗?或者知道我做错了什么吗?

当我用断点在本地运行这个程序时,我的代码肯定会被击中,消息会被打印到Stdout。

谢谢!

尝试2实际上应该是可接受的答案:

import android.util.Log
Log.e("UnitTestClassName", "===TEST MESSAGE")

我的具体问题是测试执行路径没有通过这些代码行。

最新更新