[Patches] [PATCH] Bug 6015 : Test suite improvement follow-up
koha-patchbot at kohaaloha.com
koha-patchbot at kohaaloha.com
Sun Nov 27 20:15:04 NZDT 2011
From: Paul Poulain <paul.poulain at biblibre.com>
Date: Wed, 16 Nov 2011 17:38:26 +0100
Subject: [PATCH] Bug 6015 : Test suite improvement follow-up
* fixing use Strict errors
* adding parameters and POD doc
Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
misc/load_testing/benchmark_circulation.pl | 39 +++++++++++++++++++++++----
1 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/misc/load_testing/benchmark_circulation.pl b/misc/load_testing/benchmark_circulation.pl
index 5a5f90d..717d83e 100755
--- a/misc/load_testing/benchmark_circulation.pl
+++ b/misc/load_testing/benchmark_circulation.pl
@@ -11,6 +11,7 @@ BEGIN {
eval { require "$FindBin::Bin/kohalib.pl" };
}
+use Getopt::Long;
use HTTPD::Bench::ApacheBench;
use LWP::UserAgent;
use Data::Dumper;
@@ -18,11 +19,37 @@ use HTTP::Cookies;
use C4::Context;
use C4::Debug;
-my $baseurl= $ARGV[0] || "http://am123/cgi-bin/koha/";
-my $max_tries = 200;
+my $help;
+GetOptions(
+ 'help' => \$help,
+);
+
+if ($help) {
+ print <<EOF
+This script runs a benchmark of the staff interface. It benchmark 6 different pages:
+\t- the staff main page
+\t- the catalog detail page, with a random biblionumber
+\t- the patron detail page, with a random borrowernumber
+\t- the patron search page, searching for "Jean"
+\t- the patron quick search page, searching for A
+\t- the circulation itself, doing check-out and check-in of random items to random patrons
+parameters :
+\thelp = this screen
+\tThe 1st parameter must be the URL of the staff interface to query
+\tThe 2nd parameter must be the login
+\tThe 3rd parameter must be the password
+
+SAMPLE : ./benchmark_circulation.pl http://yourstaff.org/cgi/bin/ test test
+
+EOF
+;
+die;
+}
+my $baseurl= $ARGV[0] || die "Please run me with --help for needed parameters\n";
+my $max_tries = 20;
my $concurrency = 30;
-my $user = $ARGV[1] ||'hdl';
-my $password = $ARGV[2] || 'hdl';
+my $user = $ARGV[1] || die "Please run me with --help for needed parameters\n";
+my $password = $ARGV[2] || die "Please run me with --help for needed parameters\n";
# Authenticate via our handy dandy RESTful services
# and grab a cookie
@@ -139,7 +166,7 @@ $ro = $b2->execute;
# calculate hits/sec
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
-my $b2 = HTTPD::Bench::ApacheBench->new;
+$b2 = HTTPD::Bench::ApacheBench->new;
$b2->concurrency( $concurrency );
print "Load testing patron search page";
for (my $i=1;$i<=$max_tries;$i++) {
@@ -154,7 +181,7 @@ $ro = $b2->execute;
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
-my $b2 = HTTPD::Bench::ApacheBench->new;
+$b2 = HTTPD::Bench::ApacheBench->new;
$b2->concurrency( $concurrency );
print "Load testing patron search page";
--
1.7.5.4
More information about the Patches
mailing list