Where is the output from an android instrumented test?

南笙酒味 提交于 2019-12-06 18:39:27

问题


I managed to get gradle cC to work. My test just prints out and logs one line of text.

grep -r text * fails.

where is the system.out and logging output?

thanks

edit: i found the output for the unit tests (it's in .../app/build/test-results/). but still no luck with the other.

is there a way to save the output from the instrumented tests somehow?


回答1:


Running gradlew connectedCheck will generate test results in the build directory, see

\build\reports\androidTests\connected\
  and
\build\outputs\androidTest-results\connected\

These instrumentation tests will also log their output in LogCat, along with any Log.d statements. Using System.out.print in your test cases will result in an output like this:

01-27 18:05:30.445 32664-32677/your.packagename I/System.out﹕ Test output

If you need to also persist the output you could probably write a gradle task running adb logcat and pulling the logs from the device.



来源:https://stackoverflow.com/questions/34247377/where-is-the-output-from-an-android-instrumented-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!