安卓检测测试的输出在哪里? [英] Where is the output from an android instrumented test?

查看:120
本文介绍了安卓检测测试的输出在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法使grac cC正常工作.我的测试仅打印并记录一行文本.

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

grep -r text * fails.

system.outlogging的输出在哪里?

谢谢

edit:我找到了 unit 测试的输出(位于.../app/build/test-results/中).但彼此之间仍然没有运气.

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?

推荐答案

运行gradlew connectedCheck会在构建目录中生成测试结果,请参见

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

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

这些检测测试还将其输出以及任何Log.d语句记录在LogCat中.在您的测试用例中使用System.out.print将会得到如下输出:

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:测试输出

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

如果您还需要保留输出,则可以编写运行adb logcat并从设备中提取日志的gradle任务.

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.

这篇关于安卓检测测试的输出在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆