Recent Posts

RSS Feeds

Abbot is groovy

Abbot the GUI testing tool is very cool. abbot.sf.net for thoes interested. I have been experimenting with it for a while now and I think I have a solution to work with legacy Swing code that will work. Basically

Run the editor to build the scripts
  I have built several reuseable scripts like start the app, find the doo-dad etc
  I save the scripts in the same location as the test then use a class loader to load the script (see below again)
Then mix and match the scripts in my JUnit test, code below
The JUnit test then ends up looking like this;
  protected Script loadScript(String scriptName) throws InvalidScriptException {
    URL launchURL = getClass().getClassLoader().getResource(scriptName);
    Script script = new Script();
    try {
      script.load(new InputStreamReader(launchURL.openStream()));
    } catch (InvalidScriptException e) {
      e.printStackTrace();
      throw e;
    } catch (IOException e) {
      e.printStackTrace();
      throw new InvalidScriptException(e.getMessage());
    }
    return script;
  }

  public void testLaunch() throws Throwable {
    Script launch = loadScript("test/gui/abbot/StartTheApp.xml");
    Script terminate = loadScript("test/gui/abbot/StopTheApp.xml");
    StepRunner runner = new StepRunner();
    runner.run(launch);
    Thread.sleep(3000);
    runner.run(terminate);
  }

Then with this I can mix and match the scripts all I want. I can create 'reuseable' scripts then put them together in ways to try to break the app.

This approach is similar to http://jameleon.sourceforge.net/ but its focused on Swing GUI's. If I ever get time I'll have to send email to Timothy Wall about this approach and see what he thinks, perhaps I could contribute some of the 'infrastructure' of this to Abbot.

Permalink     1 Comment



Comments:

Why not create a Jameleon plug-in for this? I have been thinking about implementing an Abbot, Jemmy, or JFCUnit plug-in for testing the Swing UI I am writing for Jameleon right now.

I'd be interested in seeing what you have.

Posted by Christian Hargraves on September 25, 2003 at 05:23 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed