Chapter 6
Testing Your Apps

Automated testing is a very good idea. I won’t give you the hard sell on it here (there are other books that do a better job, like Test Driven Development [Bec02]), but I will say that writing tests for your software will save hours upon hours of time as your product grows more complex. If your current code doesn’t work as intended or something breaks in the future, you’ll know it immediately. Sounds like something we should really use in our iOS apps, right?

The APIs we’ve covered so far are essentially common to iOS development in both Objective-C and RubyMotion. The syntax may be a little different here and there, but all the classes and methods are part of the Apple’s Cocoa frameworks. Testing, however, is a different world in RubyMotion.

The Ruby community has taken automated testing to heart. RubyMotion ships with a variant of the popular RSpec framework, a concise library that makes authoring new tests painless and requires little extra effort on the programmer’s part. In contrast to the brevity of Ruby, the Apple method of automated testing involves writing JavaScript or very verbose Objective-C. Let’s look at just how easy testing iOS apps can be with idiomatic Ruby.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset