~ubuntu-branches/ubuntu/wily/libtest-www-mechanize-perl/wily

« back to all changes in this revision

Viewing changes to README.md

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2012-06-04 18:31:08 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120604183108-67yp4fwpr37z5ofm
Tags: 1.42-1
* New upstream release.
* Make build dependency on libhtml-lint-perl versioned and add it to
  Recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Test-WWW-Mechanize
 
2
 
 
3
Test::WWW::Mechanize is a subclass of the Perl module WWW::Mechanize
 
4
that incorporates features for web application testing.  For example:
 
5
 
 
6
    use Test::More tests => 5;
 
7
    use Test::WWW::Mechanize;
 
8
 
 
9
    my $mech = Test::WWW::Mechanize->new;
 
10
    $mech->get_ok( $page );
 
11
    $mech->base_is( 'http://petdance.com/', 'Proper <BASE HREF>' );
 
12
    $mech->title_is( 'Invoice Status', "Make sure we're on the invoice page" );
 
13
    $mech->text_contains( 'Andy Lester', 'My name somewhere' );
 
14
    $mech->content_like( qr/(cpan|perl)\.org/, 'Link to perl.org or CPAN' );
 
15
 
 
16
This is equivalent to:
 
17
 
 
18
    use Test::More tests => 5;
 
19
    use WWW::Mechanize;
 
20
 
 
21
    my $mech = WWW::Mechanize->new;
 
22
    $mech->get( $page );
 
23
    ok( $mech->success );
 
24
    is( $mech->base, 'http://petdance.com', 'Proper <BASE HREF>' );
 
25
    is( $mech->title, 'Invoice Status', "Make sure we're on the invoice page" );
 
26
    ok( index( $mech->content( format => 'text' ), 'Andy Lester' ) >= 0, 'My name somewhere' );
 
27
    like( $mech->content, qr/(cpan|perl)\.org/, 'Link to perl.org or CPAN' );
 
28
 
 
29
but has nicer diagnostics if they fail.
 
30
 
 
31
# INSTALLATION
 
32
 
 
33
To install this module, run the following commands:
 
34
 
 
35
    perl Makefile.PL
 
36
    make
 
37
    make test
 
38
    make install
 
39
 
 
40
# COPYRIGHT AND LICENSE
 
41
 
 
42
Copyright (C) 2004-2012 Andy Lester
 
43
 
 
44
This library is free software; you can redistribute it and/or modify it
 
45
under the terms of the Artistic License version 2.0.