I want to unit test a swipe left/right action on the screen in Android but I haven't been able to find any documentation on it. Can anyone lend a hand? Can it even be done?
+2
A:
Generally the touch will perform an action and you will be testing the action, not the touch itself.
graham.reeds
2010-10-20 12:01:03
I don't understand. Are you saying I should do the action and have the test listen for when it has been performed.
TehGoose
2010-10-20 12:25:53
Let's say for the sake of argument AndroidOS calls OnSwipeEvent when someone swipes. In the stub of OnSwipeEvent you call MySwipeHandler. You need to test MySwipeHandler.
graham.reeds
2010-10-20 12:36:02
Is that the only way? I thought I'd be able to test to see if the swipe events actually worked instead of just testing the methods they are supposed to call. I can simulate button clicks and such. Kinda a bummer I can't do the same. Thanks anyways.
TehGoose
2010-10-20 12:48:12
Why would you want to check the swipe worked - did you write the swipe routines?
graham.reeds
2010-10-20 12:49:45
Yup I did. It is a necessity for the unit test to include them if possible.
TehGoose
2010-10-20 12:58:53