Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Perl Modules

    Test::WWW::Mechanize::Maypole 0.23

    Download button

    No screenshots available
    Downloads: 253  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.3/5)
    17 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David Baird | More programs
    Perl Artistic License / FREE
    April 11th, 2008, 17:22 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Test::WWW::Mechanize::Maypole description

    A Test::WWW::Mechanize class for Maypole.

    Test::WWW::Mechanize::Maypole is a Test::WWW::Mechanize class for Maypole.

    SYNOPSIS

    use Test::WWW::Mechanize::Maypole 'BeerDB';

    # or load a test database instead of the one configured in BeerDB.pm:
    #
    # use Test::WWW::Mechanize::Maypole 'BeerDB', 'dbi:SQLite:test-beerdb.db';
    # use Test::WWW::Mechanize::Maypole 'BeerDB', 'dbi:mysql:beer_d_b', 'dhoworth', 'password';

    $ENV{MAYPOLE_TEMPLATES} = 'path/to/templates';

    my $mech = Test::WWW::Mechanize::Maypole->new;

    #
    # basic tests:
    #
    $mech->get_ok( "http://localhost/beerdb/" );

    is( $mech->ct, "text/html" );

    $mech->content_contains( 'This is the frontpage' );

    #
    # logging in and storing cookies:
    #
    $mech->get_ok("http://localhost/beerdb/customer/buybeer");
    $mech->content_contains( 'Login to BeerDB', 'got login page' );

    # specify which form we're interested in
    $mech->form_number(1); # the 1st form

    # fill in credentials
    $mech->field( 'username' => 'landlord' );
    $mech->field( 'password' => 'handpump' );

    # get a HTTP::Response back
    my $response = $mech->click_button( name => 'submit' );
    like( $response->content, qr/Shop for beer/, 'got customer/buybeer page' );

    # check our cookies give access to other pages
    $mech->get_ok( "http://localhost/beerdb/customer/edit" );
    $mech->content_contains( 'Update your details', "got customer account edit page");


    # ... see Test::WWW::Mechanize for many more test methods

    By inheriting from Test::WWW::Mechanize, this module provides two key benefits over using Maypole::CLI in test scripts. First, it inherits a plethora of methods for testing web content. Second, cookies are handled transparently, allowing you to test applications that use cookie-based sessions and authentication.

    Testing web applications has always been a bit tricky, normally starting a web server for your application and making real HTTP requests to it. This module allows you to test Maypole web applications but does not start a server or issue HTTP requests. Instead, it passes the HTTP request parameters directly to Maypole. Thus you do not need to use a real hostname: "http://localhost/" will do.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Test::WWW::Mechanize class | Test::WWW::Mechanize Maypole | Perl module | Test | Maypole | Perl



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM