-
04 Jul
Functional View and Controller Testing with RubyMotion
RubyMotion now features a brand-new testing layer that lets you write functional specifications for the views and controllers of your application.
This layer is added on top of the existing testing framework and leverages the functionality of Apple’s UIAutomation framework. This video gives a quick overview to get you started:
Compared to the traditional usage of UIAutomation the experience here can be slightly different, as you get to write your tests in Ruby instead of Javascript, have access to the actual objects and you don’t need to use the Instruments application to run the test suite.
describe "The Timer view controller" do tests TimerController it "has a timer label" do view('Tap to start').should.not == nil end end
This feature was engineered by our friends at Fingertips and ships today in RubyMotion 1.15. You can learn more about the new APIs in the Testing RubyMotion Apps article in our developer center. The source code is also available in the HipByte/RubyMotion repository on GitHub.