Literate Functional Testing of Web Sites

Ovid on 2007-01-23T16:05:55

An email to a mailing list led me to remember what is probably the best testing presentation I have seen in a long time. This is Java code, but it should be easy, even easier, to do in Perl.

If someone were to write this module I strongly predict they would be a huge hero! The presentation lasts for an hour, but trust me, if you're interested in testing, particularly in testing the Web, it's mind-blowing. This conference was the Google London Test Automation Conference (LTAC) Google Tech Talks September 7th, 2006.


sounds tantalizing.

jesse on 2007-01-24T02:27:16

...but is there a transcript or paper anywhere? I can't actually watch the video very easily..and it's quasi-impossible to cite.

Re:sounds tantalizing.

Ovid on 2007-01-24T06:49:02

I don't know if there is a transcript, it's an open-source project you can download from here. From an example on that site:

public class GoogleTest extends NavigatingLiftTestCase {

    public void testGoogleImageSearch() throws Exception {
        goTo("http://www.google.com/");
        assertThat(page, has(title("Google")));
        clickOn(link("Images"));
        enter("kizoom", into(textField()));
        clickOn(button("Search Images"));
        assertThat(page, has(text("Kizoom summer party")));
        assertThat(it, has(image().withUrlThat(endsWith("summer04.jpg"))));
    }
}

Re:sounds tantalizing.

jesse on 2007-01-24T07:00:05

Oh. That looks a hell of a lot like Test::WWW::Declare that I've been working on with Audrey and my friend Nelson:

session "check logins" => run {
        flow "basic connectivity" => check {
                get 'http://fsck.com';
                content should match qr{fsck.com};
                click href qr{book};
                content should match qr{RT Essentials}i;

        };
};

Re: Test::WWW::Declare sounds tantalizing.

markjugg on 2007-01-27T02:14:45

Nice. I look forward to a release.

For the impatient, you can jump to 12:45 in the presentation to start seeing examples.

One of the first ones shown looked like this:

assertThat(TheCurrentPage,
has(selectBox("region")
   .with( between(9,12), options()
   .including("London", "South East")));

(which seems to be missing a closing paren on the slide.)

It also brought to mind the ill-named-but-interesting App::SimpleScan

Re:sounds tantalizing.

jmason on 2007-01-26T17:59:58

which in turn sounds a bit like WWW::Mechanize, too:

                      $mech->get( $url );

                      $mech->follow_link( text_regex => qr/download this/i );

                      $mech->submit_form(
                              form_number => 3,
                              fields => {
                                      username => 'mungo',
                                      password => 'lost-and-alone',
                              }
                      );

WWW::Mechanize is great.

Re:sounds tantalizing.

Ovid on 2007-01-26T18:34:18

Did you watch the demonstration? It's a lot more than what Mech or Selenium tools allow us to do (not that there's anything wrong with the latter). It can almost completely bridge the gap between developer and customer because it reads naturally and doesn't have things like an invocant or funny words like a 'regex'. It also does one heck of a lot more than what little I've mentioned. It's pretty cool stuff.

Selenium

djberg96 on 2007-01-24T14:17:52

Start here.

And what they call "functional literate testing" looks to me like "Behavior Driven Development".