The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Swingin' Safari

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Britt

Posts: 1319
Nickname: jamesbritt
Registered: Apr, 2003

James Britt is a principal in 30 Second Rule, and runs ruby-doc.org and rubyxml.com
Swingin' Safari Posted: Jul 7, 2009 11:54 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by James Britt.
Original Post: Swingin' Safari
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by James Britt
Latest Posts From James Britt: Ruby Development

Advertisement

I’ve been getting into using Swinger, a library that works with Jemmy and Cucumber to test JRuby Swing apps. Such as JotBot

It’s quite the slickness.

It’s still somewhat new, I believe, and I ran into some things that didn’t work quite as I wanted. So, I forked the repo and started adding things (which I hope see added back to the original repo).

The most notable additions so far are some step definitions that allow you to specify a text field by name, instead of by the current content. Very handy, especially if you have several text fields, all empty..

I also had trouble getting forms to appear via a system tray icon menu. I spent some time looking over the Jemmy docs and discussion lists, but found nothing to help me. The best I could do was get a Swing/Cucumber feature run to kick in once I manually clicked open the tray icon’s popup menu and exposed a particular menu. Not quite my goal.

My hack was to give the application being tested a Drb server that allows a client to invoke calls on application classes. Specifically, it works on controller instances. So, rather than work through a series of operations on a systray menu (which isn’t what I’m trying to test), I can invoke FooBarController.instance.open and get the frame I really want to work with.

Now, there are some risks in this. For one, I could end up shipping an app that exposes a direct and inadvertent raw API. I’m not deeply concerned with that; there are easy enough ways to ensure this only works under development conditions.

There’s the real chance I end up with tests that aren’t really testing the application under normal usage. That’s OK, at least for now. Most testing presents some amount of artfice, so it’s something one has to watch anyways.

For these systray menus, all the code does is invoke open on some controller instance; the Drb approach just side-steps having to click menu items. In fact, that was what lead me to try Drb. I simply wanted a way to call those same methods but without having to have a Swing frame. It wasn’t obvious to me how, in Swinger or Jemmy I could “talk” directly to my application except by way of some currently referenced container. So I poked a hole.

I don’t foresee adding this Drb step stuff to my fork of Swinger. I’d have to re-think how it’s done. Right now, it is pretty tailored to Jimpanzee apps, making assumptions that clearly are not valid for all JRuby Swing apps. More likely I will add the creation of Swinger/Cucumber features and steps to the Jimpanzee generator code, or possibly offload that to a Jimpanzee-centric generator driven by Rhesus .

If I think I’ll be using Swinger for all my Jimpanzee apps, it may as well be in that generator; less work for James when starting a new project.

I can perhaps then hook up a more generic template for Rhesus that provides less specific Swinger scaffolding.

Read: Swingin' Safari

Topic: Renum 1.1: pretty instance-specific method definition Previous Topic   Next Topic Topic: Agile RX and Ruby RX Philly: Earlybird Expires!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use