android - ActivityInstrumentationTestCase2 - sendkeys -


i'm trying test application through activityinstrumentationtestcase2. have few clickables in ui. use sendkeys(keyevent.keycode_dpad_down); sendkeys(keyevent.keycode_dpad_center); etc simulate keyevents on ui.

the problem is app kinda slow whereas test case relatively fast. what's happening keyevents click/navigate wrong ui element , messes test case.

is there other way of simulating keyevents tiny bit of delay ? i'm using thread.sleep(500) introduce minor delay.

is there more elegant way of doing other using thread.sleep() ?

note: aware of robotium , i'd appreciate if answers related android test framework. thanks.

there sleep method in robotium, can replace thread.sleep with:

solo.sleep(long ms); 

there way, uiautomator uses, i'm not sure, if it's safe , not cause freezing of ui:

systemclock.sleep(long ms); 

you can use wait methods, if sure view going appear. take on robotium api, see else can useful you.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -