Test::WWW::Mechanize::Maypole

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

Test::WWW::Mechanize::Maypole Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David Baird
  • Publisher web site:
  • http://search.cpan.org/~davebaird/Tree-Authz-0.03/lib/Tree/Authz.pm

Test::WWW::Mechanize::Maypole Tags


Test::WWW::Mechanize::Maypole Description

Test::WWW::Mechanize::Maypole is 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 methodsBy 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. Requirements: · Perl


Test::WWW::Mechanize::Maypole Related Software