The Reluctant Web Tester
Joe McMahon
March 16, 2006
ytester
my $status=1;
my $num_more=0;
my $num_min=$CONTEXT->getval(„num_min‟);
my $query = $CONTEXT->getval(„query‟);
my $webresults = %DOC->{webresults};
…
my $status=1;
my $num_more=0;
my $num_min=$CONTEXT->getval(„num_min‟);
my $query = $CONTEXT->getval(„query‟);
my $webresults = %DOC->{webresults};
…
nobody
understands
it
Non-US search Not tested
Ad placement Not tested
Safesearch Not tested
Subscriptions Not tested
New features Not tested
replace it
but with what?
WWW::Mechanize
Perl-controlled
browser
(almost)
testing?
$mech->status();
$mech->success();
$mech->content();
WWW::Mechanize::Cached
WWW::Mechanized::Sleepy
$mech1= new WWW::Mechanize::Sleepy;
$mech2 = new WWW::Mechanized::Cached;
# $mech1 not cached
# $mech2 not sleepy
WWW::Mechanize::Pluggable
independent plugins
WWW::Mechanize::Plugin::Cache
WWW::Mechanize::Plugin::YahooLogin
WWW::Mechanize::Plugin::Snapshot
Test::More
ok $boolean, “comment”;
is $string1, $string2, “comment”;
like $string, $regex, “comment”;
use Test::More tests=>2;
use WWW::Mechanize::Pluggable;
my $mech = new WWW::Mechanize::Pluggable;
$mech->get($some_url);
ok $mech->success(), “got the URL”;
like $mech->content, qr/Yahoo/, “brand present”;
1..2
ok 1 - got page
ok 2 - brand present
Test::WWW::Simple
use Test::More tests=>1;
use Test::WWW::Simple;
page_like $some_url, qr/Yahoo/, “brand present”;
simple_scan
URL
regex
Y or N
comment
http://yahoo.com /Yahoo!/ Y brand present
use Test::More tests=>1;
use Test::WWW::Simple;
mech->agent_alias(“Windows IE 6”);
my @accent;
page_like http://yahoo.com,
qr/Yahoo/,
qq(brand present [http://yahoo.com] [/Yahoo! should match]);
nobody is too busy
to write one line
%%release staging beta
%%query flowers hiking
http://.search.yahoo.com/search?p= /Shortcut/ Y shortcut
1..4
ok 1 - shortcut [http://beta…/search?p=flowers][/shortcut/ should match]
ok 2 - shortcut [http://beta…/search?p=hiking][/shortcut/ should match]
not ok 3 - Fetch of http://staging…/search?p=flowers failed: 500 Can‟t
connect to staging.search.yahoo.com:80 (Bad hostname staging…)
not ok 4 - Fetch of http://staging…/search?p=hiking failed: 500 Can‟t
connect to staging.search.yahoo.com:80 (Bad hostname staging…)
# Looks like you failed 2 tests of 4.
http://yahoo.com /UltraSearch/ SN proposed feature
http://yahoo.com /Answers/ TY upcoming feature
App::SimpleScan
Forget
Snapshot
Retry
Plaintext
Linkcheck
YahooLogin
simple_report
% simple_scan tests.in | simple_report MyTest
MyTest: tests=45, ok=41, failed=2, skipped=1, todo=1
%
% simple_scan -snap_dir /tmp/snaps \
-snap_prefix=http://myserver/snaps/ \
-snapshot error tests.in | simple_report -v MyTest
MyTest: tests=45, ok=41, failed=2, skipped=1, todo=1
(1 UNEXPECTEDLY SUCCEEDED)
F 18 match check [url] [/regex/ - should match]
# See snapshot http://myserver/snaps/…
F 32 no-match check [url] [/regex/ - shouldn‟t match]
# See snapshot http://myserver/snaps/…
T 42 not ready [url] [/regex/ - shouldn‟t match]
# See snapshot http://myserver/snaps/…
%
Where to put these?
TWiki
twiki_simple_scan
QuickTime™ an d a
TIFF (Uncompressed) decompressor
are need ed to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are neede d to see this picture.
QuickTime™ and a
TIFF (LZW) decompressor
are needed to see this picture.
long-running tests
Spinoff script
parent
fork and wait
child
fork and exit
grandchild
run script
what‟s it doing?
-status
# starting at …
# processing: yadda yadda
# 20% done
# 40% done
# 60% done
# 80% done
# 100% done
# yadda yadda: tests:5 failed:0 ….
# All tests complete.
# ended at …
Resources
• simple_scan
– cpan install Bundle::SimpleScan
• Me
– email: mcmahon@yahoo-inc.com
– IM: joemcmahon000 on AIM & Yahoo!