Where is the output from an android instrumented test?(android 仪器测试的输出在哪里?)
问题描述
我设法让 gradle 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.out
和 logging
输出在哪里?
谢谢
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
会在build目录生成测试结果,见
Running gradlew connectedCheck
will generate test results in the build directory, see
uild
eportsandroidTestsconnected
and
uildoutputsandroidTest-resultsconnected
这些仪器测试还将其输出以及任何 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.
这篇关于android 仪器测试的输出在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android 仪器测试的输出在哪里?


基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01