Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Apache2::ASP::Test::UserAgent
User-agent for testing Apache2::ASP web applications

Apache2::ASP::Test::UserAgent - User-agent for testing Apache2::ASP web applications



NAME

Apache2::ASP::Test::UserAgent - User-agent for testing Apache2::ASP web applications


SYNOPOSIS


  use Apache2::ASP::Test::UserAgent;

  

  my $ua = Apache2::ASP::Test::UserAgent->new( $asp );

  

  my $response = $ua->get( '/index.asp' );

  

  my $response = $ua->post( '/handlers/FormHandler', [

    username  => 'admin',

    password  => 's3cr3t',

  ]);

  

  my $response = $ua->upload( '/handlers/UploadHandler', [

    title     => 'this is my file',

    filename  => ['/path/to/file.txt']

  ]);

  

  # $response is a regular HTTP::Response object, so...:

  if( $response->is_success )

  {

    # Everything worked out OK.

  }

  else

  {

    # Request failed.

  }# end if()

  

  # Deal with forms:

  use HTML::Form;

  my $response = $ua->get( '/some-form.asp' );

  my $form = HTML::Form->parse( $response->content, '/some-form.asp' );

  $form->find_input( 'username' )->value( 'admin' );

  $form->find_input( 'password' )->value( 's3cr3t' );

  my $after_response = $ua->submit_form( $form );


DESCRIPTION

Apache2::ASP::Test::UserAgent offers the ability to test your web applications without requiring a running Apache webserver or direct human interaction.

Simply by using the Devel::Cover manpage you can easily generate code-coverage reports on your ASP scripts. Such coverage reports can be used to tell you what code is executed during your tests.


IMPORTANT BUG

After creating an instance of Apache2::ASP::Test::UserAgent you cannot print to STDOUT.

However you can warn just fine.


PUBLIC PROPERTIES


asp

Returns the the Apache2::ASP manpage object currently in use by the Apache2::ASP::Test::UserAgent object.


PUBLIC METHODS

new( $asp )

Constructor. The $asp argument should be an Apache2::ASP::Base object.

Returns a new Apache2::ASP::Test::UserAgent object.

add_cookie( $name, $value )

Appends a cookie to be sent on all future requests.

get( $url )

Makes a GET request to $url via the Apache2::ASP::Base manpage.

Content-encoding is application/x-www-form-urlencoded.

Returns an the HTTP::Response manpage object.

post( $url, $content )

Makes a POST request to $url via the Apache2::ASP::Base manpage, sending $content as its request data.

Content-encoding is application/x-www-form-urlencoded.

Returns an the HTTP::Response manpage object.

upload( $url, $content )

Makes a POST request to $url via the Apache2::ASP::Base manpage, sending $content as its request data.

Content-encoding is multipart/form-data.

Returns an the HTTP::Response manpage object.

submit_form( $form )

$form should be a valid HTML::Form object. The $form is submitted via its click() method, and the resulting the HTTP::Request manpage object is processed.

Returns a the HTTP::Response manpage object.


BUGS

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html to submit bug reports.


HOMEPAGE

Please visit the Apache2::ASP homepage at http://apache2-asp.no-ip.org/ to see examples of Apache2::ASP in action.


AUTHOR

John Drago mailto:jdrago_999@yahoo.com


COPYRIGHT AND LICENSE

Copyright 2007 John Drago, All rights reserved.

This software is free software. It may be used and distributed under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy