I am currently working on an automated GUI testing tool for Android apps, for which I need to trace all the inputs that are performed in the app along with screen captures of the activities on which they are performed.
Up to now, I have made an override of the dispatchTouchEvent of any activity of the app I'm testing.
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
float x = event.getAxisValue(MotionEvent.AXIS_X);
float y = event.getAxisValue(MotionEvent.AXIS_Y);
Log.i("touchtest", x + " " + y);
//code to take screen capture
return super.dispatchTouchEvent(event);
}
This however is very far from what I need since it requires changes in any activity to test, and it does not trace clicks on elements of the screen that are not part of the activity layout (e.g., virtual keyboard when opened).
Is there any proper way to trace any input that happens on the AVD, along with screen captures on it?