Recent Posts

RSS Feeds

J2EE AntiPatterns Book

I'm not sure how this book is being used or AntiPatterns in general are used but I like the following approach;

Starting with an app that does not work well
Identify AntiPatterns
Apply the Refactorings
This is very simplified and I hope to get more detail posted soon but I think this lays out the general idea fine.

As an example imagine a catalog app using DAO and fetching the whole graph of some product graph. This is a rough approximation of Dredge. Using the refactoring in the book the performance can be improved dramatically.

I know I need to get alot more detail here but I just don't have time today. Perhaps tomorrow...

Permalink     No Comments

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

MDE from metanology

Need to get more detail here about this but its alot like XDoclet on steriods. www.metanology.com

Permalink     No Comments