—#!perl -w
# $Id: wt,v 1.5 2003/01/07 22:05:32 m_ilya Exp $
=head1 NAME
wt - test one or more web pages
=head1 SYNOPSIS
wt [options] [WTSCRIPT ...]
Options:
-?, --help brief help message
--man full documentation
-V, --version version number
=head1 OPTIONS
=over 4
=item B<-?>
=item B<--help>
Print a brief help message and exits.
=item B<--man>
Prints the manual page and exits.
=item B<-V>
=item B<--version>
Prints version number of L<HTTP::WebTest|HTTP::WebTest> and exits.
=back
=head1 DESCRIPTION
This program runs tests using Perl module
L<HTTP::WebTest|HTTP::WebTest> on web pages containing
Perl/JSP/HTML/JavaScript/etc. and generates a detailed test report.
This program expects given input file(s) to be in format of wtscript
file. If no files are given then it expects test specification to be
passed via standard input.
See docs mentioned in section L<SEE ALSO|SEE ALSO> for full
documentation.
=head1 EXIT STATUS
=over 4
=item * 0
All tests ran successfully.
=item * 1
One or more tests failed, there was an error in the input
parameter file, or there was a system runtime error.
=back
=head1 COPYRIGHT
Copyright (c) 2000-2001 Richard Anderson. All rights reserved.
Copyright (c) 2001-2003 Ilya Martynov. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<HTTP::WebTest|HTTP::WebTest>
L<HTTP::WebTest::Cookbook|HTTP::WebTest::Cookbook>
=cut
use
strict;
use
Pod::Usage;
use
HTTP::WebTest;
my
%OPTIONS
= ();
GetOptions(\
%OPTIONS
,
qw(help|? version|V man)
) or pod2usage(2);
pod2usage(1)
if
$OPTIONS
{help};
pod2usage(
-verbose
=> 2)
if
$OPTIONS
{man};
if
(
$OPTIONS
{version}) {
my
$version
= HTTP::WebTest->VERSION;
<<TEXT;
wt - test one or more web pages.
This program uses HTTP::WebTest version $version.
Copyright (c) 2000-2001 Richard Anderson. All rights reserved.
Copyright (c) 2001-2003 Ilya Martynov. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
TEXT
exit
0;
}
@ARGV
=
'-'
if
@ARGV
< 1;
exit
main();
sub
main {
my
$webtest
= HTTP::WebTest->new();
my
$exit_status
= 0;
for
my
$file
(
@ARGV
) {
$webtest
->run_wtscript(
$file
);
$exit_status
= 1
unless
$webtest
->have_succeed;
}
return
$exit_status
;
}