Friday, March 28, 2008

Testing RIAs with WebDriver

If you need to test Rich Internet Applications from Java, take a look at Webdriver.

Things I like about it:

  • It uses real browsers to run the tests, quirks and all
  • It's got a literate testing interface based on Hamcrest and inspired by LiFT.
Here's a very simple example.It's doing simple tests on a static html site:
public class HomePageTest extends HamcrestWebDriverTestCase {

@Override
protected WebDriver createDriver() {
return new HtmlUnitDriver();
}

public void testHomePageHasTitleAndHeading()
throws Exception {
goTo("http://test.intranet");
assertPresenceOf(title()
.with(text(startsWith("Agile"))));
assertPresenceOf(title()
.with(text(containsString("Cocking and Co."))));
assertPresenceOf(heading(1)
.with(text(equalTo("Agile Application Development"))));
}
}



This won't quite work out of the box, as there is no heading finder, but adding one is easy:

public class HeadingFinder extends HtmlTagFinder {
private final int level;

public HeadingFinder(int level) {
this.level = level;
}

@Override
protected String tagDescription() {
return "heading level "+level;
}

@Override
protected String tagName() {
return "h"+level;
}

public static HeadingFinder heading(int level) {
return new HeadingFinder(level);
}
}

It's fairly new, but there are now pre-built binaries available.

Tuesday, March 25, 2008

Category Theory/Haskell learning group in London

Peter Marks organised a BOF (Birds of a feather) session on Category Theory at Spa2008. To my surprise about twelve of us turned up. We discovered a shared intuition (bizarre though it seems) that Category Theory will somehow shape the next big thing in application development. Less surprisingly, we also discovered a common enthusiasm for Haskell.

We want to build on this. Most of us are based in London, or can reach it easily. We plan to meet regularly (about once a month) to explore these ideas and to help each other to learn.

I'll post more about this as soon as we have a date and location for our first meeting.

Spa2008 retrospectve

I'm back from Spa2008, and my head is buzzing.

I felt this was the best Spa conference in recent years. As chairman I'm biased, but I'm not responsible for the quality. That's down to the programme chairs (Eoin Woods and Ivan Moore) and to Andy Moorley who organised things perfectly.

I went to (and really enjoyed):
  • Mirror, Mirror on the wall - why me? Chris Cooper-Bland and Portia Tung
  • Thou Shalt Integrate by the Sweat of Thy Brow... Robert James and Eoin Woods
  • The Need for Speed Paul Dyson and John Nolan
  • Awesome Acceptance Testing Dan North and Joe Walnes
  • Spanish Guitar Recital David Harvey
  • Is Software Practice Advancing? John Daniels and friends
  • A few things I learned in 50 years of programming L Peter Deutsch
  • Big Ball of Money, Big Ball of Mud: Economics and Legacy Code Michael Feathers
  • Closing the Knowing Doing Gap Allan Kelly and Lise Hvatum
Now it's time to start thinking about Spa2009!