Reputation: 149
I have been googling about this issue for hours, and I'm stumped. Im trying to write a comprehensive test suite for android devices, and my first idea was to validate test results using logcat output. Logcat has all the event info I need from both the OS and our apps.
Using Robotium or Monkeyrunner, I found no way to access logcat on the fly. Creating an external app to monitor logcat is out of the question (hard to sync events to results).
Any ideas guys?
Upvotes: 4
Views: 2827
Reputation: 2301
Use logcat -d -v time option at regular checkpoints,parse it then proceed. will this help?
Upvotes: 1
Reputation: 4274
Try this. Add the following permission to your Robotium manifest file:
<uses-permission android:name="android.permission.READ_LOGS" />
Then create a thread in your setup method, and have it perform the following:
Process proc = Runtime.getRuntime().exec("logcat -d");
BufferedReader reader = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
Then read using:
reader.readLine()
Upvotes: 6