iphone_testify
by Paul Wilson
http://merecomplexities.com
DESCRIPTION:
Utility to help set up and iPhone project for testing using code from The Google Toolbox for Mac.
FEATURES:
-
Copies google test files into the “google_testing” directory
-
Creates a UnitTests directory
-
Adds Rakefile for compiling (via xcode) and reporting test failures (on console and via Growl)
-
Adds an ‘autoiphonetest.rb’ file for autotest style running of all tests when a change has been detected.
TODO:
There are a few more things I’d like this gem to do.
-
Generation of test stubs
-
Automatic setup of _Unit Test_ target through XCode (via automation?)
-
Automatic addition of test files to _Unit Test_ target
SYNOPSIS:
From console cd to your project root directory. Type
% iphone_testify
Unfortunately there are some manual stages needed to add a _Unit Test_ target to your Xcode project. This is based on the Google Toolbox Wiki instructions
-
Create a new iPhone Target (Cocoa Touch Application) via “Project Menu > New Target…” called “Unit Test”.
-
Add all the ObjectiveC files that have been copied to your ‘google_testing’ directory to this target
-
Add your project files to this target
-
Add a new ‘run script’ build phase as the last step of your target build via “Project Menu > New Build Phase > New Run Script Build Phase”, and dragging it to the end of the build steps if needed.
-
Edit your Run Script Build Phase by double clicking it, and set the shell to “/bin/sh” and the script to “google_testing/RunIPhoneUnitTest.sh”
To autocompile/autorun all tests every time code changes
% ./autoiphonetest.rb
To compile and run tests if code has changed since the last run
% rake auto:test
To compile and run all tests even if nothing has changed since the last time
% rake auto:test:all
REQUIREMENTS:
-
OS X Leopard
-
XCode 3.1 (containing the iPhone SDK)
-
Ruby (comes on Leopard)
INSTALL:
% sudo gem sources -a http://gems.github.com # (you only need to do this once)
% sudo gem install paulanthonywilson-iphone_testify
LICENSE:
Contains file taken from The Google Toolbox for Mac. See skeleton/google_testing/GoogleToolboxForMac.license which is also copied into the google_testing directory.
(The MIT License)
Copyright © 2009
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.