| HTTP-WebTest documentation | Contained in the HTTP-WebTest distribution. |
HTTP::WebTest::Plugin::ResponseTimeTest - Tests for response time
Not Applicable
This plugin supports web server response time tests.
Minimum web server response time (seconds) expected.
Any number less than max_rtime (if max_rtime is specified).
Maximum web server response time (seconds) expected.
Any number greater that zero and greater than min_rtime (if
min_rtime is specified).
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.
HTTP::WebTest::API (HTTP::WebTest::API)
HTTP::WebTest::Plugins (HTTP::WebTest::Plugins)
| HTTP-WebTest documentation | Contained in the HTTP-WebTest distribution. |
# $Id: ResponseTimeTest.pm,v 1.7 2003/03/02 11:52:09 m_ilya Exp $ package HTTP::WebTest::Plugin::ResponseTimeTest;
use strict; use base qw(HTTP::WebTest::Plugin);
sub param_types { return q(min_rtime scalar max_rtime scalar); } sub check_response { my $self = shift; # response time my $rtime = $self->webtest->current_response_time; $self->validate_params(qw(min_rtime max_rtime)); # response time limits my $min_rtime = $self->test_param('min_rtime'); my $max_rtime = $self->test_param('max_rtime'); # test results my @results = (); my @ret = (); # check minimal size if(defined $min_rtime) { my $ok = $rtime >= $min_rtime; my $comment = 'Response time ('; $comment .= sprintf '%6.2f', $rtime; $comment .= ' ) is > or ='; $comment .= sprintf '%6.2f', $min_rtime; $comment .= ' ?'; push @results, $self->test_result($ok, $comment); } # check maximal size if(defined $max_rtime) { my $ok = $rtime <= $max_rtime; my $comment = 'Response time ('; $comment .= sprintf '%6.2f', $rtime; $comment .= ' ) is < or ='; $comment .= sprintf '%6.2f', $max_rtime; $comment .= ' ?'; push @results, $self->test_result($ok, $comment); } push @ret, [ 'Response time check', @results ] if @results; return @ret; }
1;