問題描述
我設法讓 gradle cC 工作.我的測試只是打印出來并記錄一行文本.
I managed to get gradle cC to work. My test just prints out and logs one line of text.
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
這些儀器測試還將其輸出以及任何 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 儀器測試的輸出在哪里?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!