I know a way, but I think its a bit far fetched for a maintainable test.
- Jailbreak an iPhone/iPad
- Install VNC server software
- Use a test framework like T-Plan Robot 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