How can I unit test an Android Activity that acts on Accelerometer?

Posted by Corey Sunwold on Stack Overflow See other posts from Stack Overflow or by Corey Sunwold
Published on 2010-05-10T22:49:35Z Indexed on 2010/05/10 22:54 UTC
Read the original article Hit count: 229

I am starting with an Activity based off of this ShakeActivity and I want to write some unit tests for it. I have written some small unit tests for Android activities before but I'm not sure where to start here. I want to feed the accelerometer some different values and test how the activity responds to it. For now I'm keeping it simple and just updating a private int counter variable and a TextView when a "shake" event happens.

So my question largely boils down to this:

How can I send fake data to the accelerometer from a unit test?

© Stack Overflow or respective owner

Related posts about android

Related posts about unit-testing