Re: [MacRuby-devel] Unit testing in Xcode
On Apr 4, 2009, at 4:55 AM, John Shea wrote: Brian Marick has a good chapter on testing in his "RubyCocoa, bringing some love. " using standard ruby testing methodologies. You can get this as a pdf book (its not out in print yet) Thanks. Note, though, that I don't test in Xcode. I don't even code in Xcode - I use Aquamacs emacs. So the testing I describe is plain old testing at the command line. It's the equivalent of Command-Tab and typing !! to the shell. (As an emacs user, of course, it's all done inside of emacs, so all I type is F4. I imagine a little AppleScript could make it one keystroke for non-emacs users.) - Brian Marick, independent consultant Mostly on agile methods with a testing slant www.exampler.com, www.exampler.com/blog, www.twitter.com/marick ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Unit testing in Xcode
No definitely not. This is Ruby, so we can do better ;-) I have not yet finished porting Rucola to MacRuby, as of yet MacRuby is not mature enough to run some code we have on RubyCocoa yet. However, the port process was started, especially on our test case helper, so this might currently work good enough for you. The current test case code is in: http://github.com/alloy/rucola/blob/macruby/lib/rucola/test_case.rb If you'd like to add test/spec to the mix, there were some extra workarounds needed (not sure if it's still the case with test-spec 0.10): http://github.com/alloy/rucola/blob/macruby/lib/rucola/test_spec.rb For an example of a controller test see: http://github.com/alloy/webapp-app/blob/34e270667f34046bdf3379cd124788825dd59e8b/WebAppGenerator/test/controllers/test_application_controller.rb And a model test: http://github.com/alloy/webapp-app/blob/34e270667f34046bdf3379cd124788825dd59e8b/WebAppGenerator/test/models/test_web_app_bundle.rb Note that test/spec wraps around regular old test/unit. Example: describe "Foo" do it "should exist" do lambda { Foo }.should.not.raise NameError end end Is the equivalent of: class FooTest < Test::Unit::TestCase def test_foo_exists assert_not_raise(NameError) { Foo } end end I'm sure it can be hard to understand some parts, so let me know when in doubt. Eloy On 4 apr 2009, at 11:39, Frisco Del Rosario wrote: Is unit testing in Xcode necessarily as cumbersome as it seems to be described in http://developer.apple.com/documentation/developertools/Conceptual/UnitTesting/Articles/CreatingTests.html ? Xcode is making me miss the days I could just append a TestCase instance with TextMate and hit command-r. ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Unit testing in Xcode
Brian Marick has a good chapter on testing in his "RubyCocoa, bringing some love. " using standard ruby testing methodologies. You can get this as a pdf book (its not out in print yet) (I am in no way affiliated to Brian, Aaron and the other Cocoa/Ruby authors i mention on this list - my apologies if it seems so). On Apr 4, 2009, at 11:39 AM, Frisco Del Rosario wrote: Is unit testing in Xcode necessarily as cumbersome as it seems to be described in http://developer.apple.com/documentation/developertools/Conceptual/UnitTesting/Articles/CreatingTests.html ? Xcode is making me miss the days I could just append a TestCase instance with TextMate and hit command-r. ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel