[MacRuby-devel] My Current UI Testing Setup

Ryan Davis ryand-ruby at zenspider.com
Wed Jun 23 12:15:40 PDT 2010


Here is my current macruby UI testing setup:

Rakefile:

+ Has an isolate setup to pull down all my testing gems.
+ task build - runs xcodebuild to build a debug app
+ task link  - runs a build and then hard links source files to build
               files

~/.emacs.el:

+ sets 'backup-by-copying-when-linked to t - allowing work on
  hardlinked files to go unimpeded.

.autotest:

+ Sets ENV['RUBY'] to macruby.
+ Sets ENV['MACRUBY_TESTING'] to 1.
+ Sets ENV['GEM_HOME'] and ENV['GEM_PATH'] with expanded paths to pick
  up isolated gems during test runs.
+ initialize hook sets the test framework to minitest and runs the
  link rake task.
+ Overrides Autotest#make_test_cmd to execute the binary directly.

lib/app_controller.rb:

+ sets $TESTING = ENV['MACRUBY_TESTING']
+ applicationDidFinishLaunching requires minitest/macruby if $TESTING

rb_main.rb:

+ needed to be tweaked to skip loading test files.

So, when I fire up autotest it will build the application and then
hardlink all the original source files into the build. This allows
autotest to scan the lib and test dirs but invoking the application
will pick up all my changes without having to rebuild. This greatly
speeds up development.

When autotest runs the application directly, it does so with
MACRUBY_TESTING set in the environment. The application sees this and
sets $TESTING to true and once the app is done launching, it loads
minitest/macruby. That in turn loads up all the test files in the
build dir and then runs the tests. Once the tests are run, it exits
with the appropriate exit code depending on test results.




More information about the MacRuby-devel mailing list