使用“adb shell am instrument"时如何检索测试结果 [英] How to retrieve test results when using "adb shell am instrument"
问题描述
我正在使用以下命令在我的 Android 设备上执行一些测试:
I'm executing some tests in my Android device by using the following command:
adb shell am instrument -wpackage.name/android.test.runner.AndroidJUnitRunner
adb shell am instrument -w package.name/android.test.runner.AndroidJUnitRunner
我可以通过STDOUT看到测试进度和简单的结果.但是,这个过程是否也会在设备内部生成一个结果文件(xml、html 等)?如果是,它存储在哪里?
I can see the test progress and simple results through STDOUT. But, does this process also generates a results file inside the device (xml, html, etc)? If yes, where is it stored?
谢谢
推荐答案
但是,这个过程是否也会在设备内部生成一个结果文件(xml、html 等)?
But, does this process also generates a results file inside the device (xml, html, etc)?
不,没有.
报告生成通常在比am instrument"更高的层处理.如果您使用 Gradle 运行测试,它应该会为您生成报告.我相信这也是 Android Studio 所依赖的.
Report generation is generally handled at a higher layer than 'am instrument'. If you run your tests using Gradle, it should generate the report for you. I believe this is what Android Studio relies on as well.
如果您必须从测试本身生成报告,您可以使用自定义测试运行器.请参阅此答案以了解一种方法:http://www.stackoverflow.com/a/5574418/1999084
If you must generate the report from the test itself, you can use a custom test runner. See this answer for one way to do it: http://www.stackoverflow.com/a/5574418/1999084
这篇关于使用“adb shell am instrument"时如何检索测试结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!