Alexis Sukrieh > Test-WWW-Mechanize-Runner-0.0.1 > Test::WWW::Mechanize::Runner

Download:
Test-WWW-Mechanize-Runner-0.0.1.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.0.1   Source  

NAME ^

Test::WWW::Mechanize::Runner - test-suites maker for "WWW::Mechanize"-compatible agents.

DESCRIPTION ^

This module is designed to help you write functional test-suites for web-applications without getting stuck with a specific WWW::Mechanize agent.

You write the scenario in your module (that inherits from the runner) and define suites.

Then, you can easily write your test script with 3 lines.

EXAMPLE ^

First, write a scenario with the runner :

    package TestGoogle;
    use Test::Simple;
    use Test::WWW::Mechanize::Runner;
    use base 'Test::WWW::Mechanize::Runner'; # this may become automatic in
                                             # future versions
    
    suite google_homepage => sub {
        # you receive the agent defined for the session 
        my ($agent) = @_;

        ok( $agent->get('http://www.google.com'), 
            'GET http://www.google.com' );
        ok($agent->form_number(1), 'select the form' );
        # ... 
    };

    1;

Then you can write your test script for running the suite with the agent you like:

    test-google-mozilla.t:

    use TestGoogle;
    TestGoogle->init('mozilla');
    TestGoogle->run(@ARGV);

The test suite is then run with a Mozilla::Mechanize agent, if possible.

You can also name the test suites you want to run if you want to run only a specific set of suites, instead of all of them:

    $ perl test-google-mozilla.t                 # will run all the test suites defined
    $ perl test-google-mozilla.t google_homepage # will only run "google_homepage"

SUPPORTED AGENTS ^

In this version the following agents are supported :

default : WWW::Mechanize
mozilla : Mozilla::Mechanize
msie : Win32::IE::Mechanize
mozilla-gui : Mozilla::Mechanize::GUITester

AUTHOR ^

This module was written by Alexis Sukrieh <sukria+perl@sukria.net>.

COPYRIGHT AND LICENSE ^

Copyright 2007 by Alexis Sukrieh.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.