rbiphonetest - Unit Test iPhone apps with Ruby
DESCRIPTION:
Want to write iPhone apps with unit tests? Want to write them in Ruby?
-
Blog introduction: drnicwilliams.com/2008/07/04/unit-testing-iphone-apps-with-ruby-rbiphonetest/
-
Video introduction: www.vimeo.com/1262916
-
Google Group: groups.google.com/group/rbiphonetest
-
Bugs/Features: drnic.lighthouseapp.com/projects/13763-rbiphonetest
FEATURES/PROBLEMS:
-
Installs a Ruby-based unit testing framework into an iPhone/Objective-C/Xcode project
-
Provides generators to create Objective-C classes with associated Ruby tests
-
Uses RubyCocoa to bridge between Ruby tests and Objective-C via Loadable Bundles
Known issues:
-
Currently only test/unit tests created; rspec etc coming soon
-
Currently only supports Foundation framework, since its common between OS X and iPhone
-
The plan is to mock out all the UIKit.framework classes so they can exist in RubyCocoa land.
-
MacRuby (instead of RubyCocoa) is not yet tested
SYNOPSIS:
-
Create a new iPhone project using Xcode templates
-
Open the terminal
-
Change to project folder
-
‘rbiphonetest .`
This adds the test framework, a Rakefile, and an ‘autotest` config file.
You can now create testable Objective-C models/classes using the generator: $ script/generate model WidgetMaker create Classes/WidgetMaker.h create Classes/WidgetMaker.m create test/test_widget_maker.rb
To run tests you have several options:
-
‘rake` or `rake test`
-
‘autotest` (after installing the ZenTest gem)
All options will re-build the Objective-C code (if necessary) before running the tests.
If using autotest, your tests will be re-run if the test files or the Objective-C files are modified.
REQUIREMENTS:
-
RubyCocoa (installed on OS X Leopard; latest version at rubycocoa.com)
-
XCode 3.1 (containing the iPhone SDK)
INSTALL:
sudo gem install rbiphonetest
From source: git clone git://github.com/drnic/rbiphonetest.git cd rbiphonetest rake install_gem
LICENSE:
(The MIT License)
Copyright © 2008-9 Dr Nic Williams
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.