[MacRuby-devel] How to Configure Xcode to Run Test in MacRuby Project?

Michael Johnston lastobelus at mac.com
Fri Nov 4 12:15:45 PDT 2011

I wanted to be able to run tests from either Xcode or individually from a shell, AND my project has some ObjC bits, so what I settled on doing was creating a Framework target that compiles the ObjC parts with a  run script build phase that calls a ruby script that loads the test files and calls Bacon.run.

This script sets ENV['DYLD_FRAMEWORK_PATH'] to ENV['BUILT_PRODUCTS_DIR'], and copies the framework in this directory to a temporary location. Then when I run tests individually from a shell, the spec helper file looks for this framework and sets ENV['DYLD_FRAMEWORK_PATH']  to it.

So long as I am only working on Ruby files I can use the normal command line way of working with ruby / tests. If I change any ObjC code, I just have to build the test framework again from xcode (or using 'xcodebuild -target TestFramework' ). You could also just run xcodebuild every time from spechelper, but this slows things down  a bit.

The one thing that is annoying about this setup is that navigating to the run script build phase log when building the test framework is cumbersome.


Michael Johnston
lastobelus at mac.com

On 2011-10-31, at 4:48 PM, techzen wrote:

> Okay, I'm sure I'm just missing something simple but I can't figure out how to include test in a MacRuby Xcode project. I've been using MacBacon to learn MacRuby in TextMate but I don't see how to do so in Xcode.
> My google-fu has failed me as well because all the example are how to include MacRuby test in an Objective-C project and the build settings don't seem to translate to a pure MacRuby project.  It looks to me like I would have to build a custom testing bundle from scratch for each project but that can't be correct. 
> Any pointers would be appreciated. I don't know much ruby so I'm sure I'm missing something.
> TechZen
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

More information about the MacRuby-devel mailing list