I know a way, but I think its a bit far fetched for a maintainable test.

1. Jailbreak an iPhone/iPad
2. Install VNC server software
3. Use a test framework like [T-Plan Robot][1] to run tests against the device over VNC


There is also a older open-source T-Plan robot version at: http://sourceforge.net/projects/tplanrobot/

Seems that you do not have to jailbreak if you use the iOS mirror feature: http://www.t-plan.com/robot/docs/latest/scripting/ios.html

  [1]: http://www.t-plan.com/robot/