1Test::HTTP::Server::SimUpsleer::CSotnatsrhiWbauTrtenesidtn:gP:seH(rT3lT)PD:o:cSuemrevnetra:t:iSoinmple::StashWarnings(3)
2
3
4

NAME

6       Test::HTTP::Server::Simple::StashWarnings - catch your forked server's
7       warnings
8

SYNOPSIS

10           package My::Webserver::Test;
11           use base qw/Test::HTTP::Server::Simple::StashWarnings My::Webserver/;
12
13           sub test_warning_path { "/__test_warnings" }
14
15
16           package main;
17           use Test::More tests => 42;
18
19           my $s = My::WebServer::Test->new;
20
21           my $url_root = $s->started_ok("start up my web server");
22
23           my $mech = WWW::Mechanize->new;
24
25           $mech->get("$url_root/some_action");
26
27           $mech->get("/__test_warnings");
28           my @warnings = My::WebServer::Test->decode_warnings($mech->content);
29           is(@warnings, 0, "some_action gave no warnings");
30

DESCRIPTION

32       Warnings are an important part of any application. Your web application
33       should warn the user when something is amiss.
34
35       Almost as importantly, we want to be able to test that the web
36       application gracefully copes with bad input, the back button, and all
37       other aspects of the user experience.
38
39       Unfortunately, tests seldom cover what happens when things go poorly.
40       Are you "sure" that your application checks authorization for that
41       action? Are you "sure" it will tomorrow?
42
43       This module lets you retrieve the warnings that your forked server
44       throws. That way you can test that your application continues to throw
45       warnings when it makes sense. Catching the warnings also keeps your
46       test output tidy. Finally, you'll be able to see when your application
47       throws new, unexpected warnings.
48

SETUP

50       The way this module works is it catches warnings and makes them
51       available on a special URL (which must be defined by you in the
52       "test_warning_path" method).  You can use "WWW::Mechanize" (or
53       whichever HTTP agent you prefer) to download the warnings. The warnings
54       will be serialized. Use decode_warnings to get the list of warnings
55       seen so far (since last request anyway).
56
57       Warnings are encoded using Storable by default, but your subclass may
58       override the "encode_warnings" and "decode_warnings" methods.
59

TIPS

61       Setting the "TEST_VERBOSE" environment variable to a true value will
62       cause warnings to be displayed immediately, even if they would be
63       captured and tested later.
64

AUTHOR

66       Shawn M Moore, "<sartak at bestpractical.com>"
67

BUGS

69       Please report any bugs or feature requests to
70       "bug-test-http-server-simple-stashwarnings at rt.cpan.org", or through
71       the web interface at
72       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=test-http-server-simple-stashwarnings>.
73
75       Copyright 2008 Best Practical Solutions.
76
77       This program is free software; you can redistribute it and/or modify it
78       under the same terms as Perl itself.
79
80
81
82perl v5.36.0                      2T0e2s3t-:0:1H-T2T0P::Server::Simple::StashWarnings(3)
Impressum