Testing App UI and Controllers
In addition to a basic RSpec testing framework, RubyMotion includes extensions that help us test complex interactions with views and a device. You can specifically test events such as taps, flicks, and pinches to ensure that your callbacks are functioning accordingly.
Let’s walk through an example of RubyMotion’s UI test helpers. We’re going to programmatically tap a UIButton and assert that some state has changed after the tap. Even better, we’ll make sure to visibly alter the UI after the tap to make it obvious while the test is running in the simulator.
Since UI testing requires a UIViewController instance, we need one of our own. Create the app/controllers directory and a button_controllerrb file within. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access