Re: [Grinder-use] write login testing script discussion
Distributed load testing framework - Java, Jython, or Clojure scripts.
Brought to you by:
philipa
|
From: Philip A. <pa...@be...> - 2007-01-30 16:12:47
|
The name of the key used to pass the password will be coming back to
you in the body of the previous response. E.g. that for request58.
You need to parse this body and grab the key from it.
Having variable form keys is most unusual, and The Grinder doesn't
have anything built in that will help you do this. You'll need to=20
write a jython function (probably using regular expressions). Your
code would then look something like:
def calculatePasswordKey(self, response):
# TO DO
def page58(self):
response =3D request5801.Get(...)
self.passwordKey=3DcalculatePasswordKey(response)
def page59:
# As before but with....
NVPair(self.passwordKey, 'test'), ),
Regards,
- Phil
-----Original Message-----
From: gri...@li... on behalf of C myhid
Sent: Tue 30/01/2007 12:00
To: gri...@li...
Subject: [Grinder-use] write login testing script discussion
=20
Hello,everbody.
Yesterday,I install a open source portal in my computer and I want to test =
its performance in localhost in order to compare it with that of other port=
als.I used Grinder 3.0 to do the test and at first I used TCPProxy to recor=
d the script of logining in the portal.
=20=20=20=20=20=20
The following content is part of the script recorded by TCPProxy,it loged m=
y logining in the portal twice times.
=20
# The Grinder 3.0-beta32
# HTTP script recorded by TCPProxy at 2007/1/29=20
=20
from net.grinder.script import Test
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
from HTTPClient import NVPair
connectionDefaults =3D HTTPPluginControl.getConnectionDefaults()
httpUtilities =3D HTTPPluginControl.getHTTPUtilities()
=20
# To use a proxy server, uncomment the next line and set the host and port.
# connectionDefaults.setProxyServer("localhost", 8001)
=20
# These definitions at the top level of the file are evaluated once,
# when the worker process is started.
=20
connectionDefaults.defaultHeaders =3D \
( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1=
; SV1)'),NVPair('Accept-Language', 'zh-tw'), )
headers0=3D ( NVPair('Accept', '*/*'), )
headers1=3D \
( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, =
application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms=
-powerpoint, application/msword, */*'), )
=20
headers2=3D ( NVPair('Accept', '*/*'),
NVPair('Referer', 'http://localhost:8080/web/guest/home'), )
=20
headers3=3D ( NVPair('Accept', '*/*'),
NVPair('Referer', 'http://localhost:8080/web/guest/home'), )
....................................................................
headers10=3D \
( NVPair('Accept', '*/*'),
NVPair('Referer', 'http://localhost:8080/c/portal/layout?p_l_id=3Ddefau=
lt'), )
=20
url0 =3D 'http://localhost:8080'
=20
# Create an HTTPRequest for each request, then replace the
# reference to the HTTPRequest with an instrumented version.
# You can access the unadorned instance using request101.__target__.
request101 =3D HTTPRequest(url=3Durl0, headers=3Dheaders0)
request101 =3D Test(101, 'GET redir.dll').wrap(request101)
=20
request201 =3D HTTPRequest(url=3Durl0, headers=3Dheaders1)
request201 =3D Test(201, 'GET /').wrap(request201)
=20
request301 =3D HTTPRequest(url=3Durl0, headers=3Dheaders1)
request301 =3D Test(301, 'GET c').wrap(request301)
return result
...........................................................................=
...........................................................................=
...........................................................................=
.................................................... def page39(self):
"""POST login (requests 3901-3903)."""
=20=20=20=20
# Expecting 302 'Moved Temporarily'
result =3D request3901.POST('/c/portal/login',
( NVPair('cmd', self.token_cmd),
NVPair('tabs1', self.token_tabs1),
NVPair('rememberMe', self.token_rememberMe),
NVPair('login', 'te...@po...'),
NVPair('jshjrsbine_password', 'test'), ),
( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
=20
def page59(self):
"""POST login (requests 5901-5903)."""
=20=20=20=20
# Expecting 302 'Moved Temporarily'
result =3D request5901.POST('/c/portal/login',
( NVPair('cmd', self.token_cmd),
NVPair('tabs1', self.token_tabs1),
NVPair('rememberMe', self.token_rememberMe),
NVPair('login', 'te...@po...'),
NVPair('adzqlwjkqa_password', 'test'), ),
( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
=20
=20
from above script,we can see that at first time I posted login ,the portal =
generated a name of the password text box in the login interface,and at sec=
ond time,the portal generated a new name for it,I have identified the passw=
ord text box name in red color and underlined.If I used it as test script,t=
he password text box name of NVPair will not conform with that of real test=
ing,Therefore,I can not use it as a test script.I have thought this questio=
n for a long time,but I have not found the mothod to solve it.
Do you have any experience in testing such type web performance using Grin=
der? Please help me to solve it.Thank you for your kind attention
=20
___________________________________________________________________________=
_________
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
http://mobile.yahoo.com/services?promote=3Dmail
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
|