Question

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?

Was it helpful?

Solution

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()

OTHER TIPS

Use logcat -d -v time option at regular checkpoints,parse it then proceed. will this help?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top