1

How would you set up regression tests that mock UITouches?

I am developing an iOS-game and want to have some regression tests for core functionality. I would need to trigger calls to touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event etc. automatically for a fixed list of fake touches then I could automatically evaluate the test result.

Miriam
  • 1,178
  • 2
  • 13
  • 23

1 Answers1

1

There is no public constructor, but people have found a way, see

http://www.cocoawithlove.com/2008/10/synthesizing-touch-event-on-iphone.html

jimpic
  • 5,360
  • 2
  • 28
  • 37
  • Sounds good. I'll give it a try. Will accept answer or report back afterwards. – Miriam Dec 12 '12 at 11:28
  • This indeed worked for me! Few changes required: See http://stackoverflow.com/questions/12724233/simulating-uitouch-in-xcode-4-5-programmatically-uispec, modify for ARC and I also need to set locationInWindow for UITouch. – Miriam Jan 30 '13 at 16:10