【发布时间】:2021-07-26 05:38:33
【问题描述】:
我使用 ADB 在多台设备上并行运行测试:
adb -s 11.11.11.111:5555 shell "CLASSPATH=$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -r -w -e targetInstrumentation com.my.app.debug.test/androidx.test.runner.AndroidJUnitRunner -e clearPackageData true -e numShards 2 -e shardIndex 0 -e debug false androidx.test.orchestrator/androidx.test.orchestrator.AndroidTestOrchestrator" &
adb -s 11.11.11.112:5555 shell "CLASSPATH=$(pm path androidx.test.services) app_process / androidx.test.services.shellexecutor.ShellMain am instrument -r -w -e targetInstrumentation com.my.app.debug.test/androidx.test.runner.AndroidJUnitRunner -e clearPackageData true -e numShards 2 -e shardIndex 1 -e debug false androidx.test.orchestrator/androidx.test.orchestrator.AndroidTestOrchestrator" &
wait
如果测试失败,通常会显示错误消息/堆栈跟踪,但并非总是如此。因此,将应用程序的日志保存在文件中会很有帮助。 测试完成后我尝试了以下命令:
adb -s 11.11.11.111:5555 logcat | grep "com.my.app.*" > app/build/reports/logcat.txt
但是该命令仅将系统日志保存在文件中,而不是我在 Android Studio 中运行测试时通常可以看到的日志(在 Android Studio 的 logcat 窗口中)。
【问题讨论】:
标签: android testing logging adb logcat