[MacRuby-devel] testing macruby/hotcocoa apps

Matt Aimonetti mattaimonetti at gmail.com
Mon May 11 23:18:44 PDT 2009


This is a very interesting topic and probably Eloy's favorite theme ;)

Overall, the Ruby community strongly believes in testing, as a matter of
fact we have so many testing frameworks I did not even test them all:
test/unit, rspec, shoulda, bacon, context, cucumber etc....

Doing unit tests on your "models" isn't really a challenge, we probably all
know how to do that and we have the tools to do so. The real challenge is to
test expected behaviors at the highest level: the GUI.

I talked with few very smart people during RailsConf and before that I
talked to some Java friends of mine developing swing apps. It seems that
everybody agrees that testing behavio(u)rs at the GUI level is really
challenging. The approval testing approach is nice but it's kind of a pain
since you need to validate every UI change.
What would be totally awesome is a solution like Webrat + Cucumber
http://cukes.info/ but for Cocoa apps developed using MacRuby.

Think about it, would it be really nice if we could do something like that:

Given I'm a valid twitter user
When I enter my credentials
Then I should see the last 50 tweets sent by my friends

To do this kind of magic, we need to be able to parse the UI, the good thing
is that thanks to MacRuby, we have an easy way to do full introspection on
all the objects.
So, in theory, we should be able to walk down the 'tree', starting at the
NSApp level, pick a window, a view, an tableview, a row and check on its
content after a button was clicked. This way, we can trigger UI components
and see resulting behavior.
We could even imagine some sort of selenium-type DSL to drive our tests in
real time :)

Before I get too excited, I'd like to hear what you guys think and what you
believe you need to write better code?

- Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090511/5b2aaebc/attachment.html>


More information about the MacRuby-devel mailing list