Grinder script execution error
Chanduram Dowlathram <[email protected]> Thu, 4 Sep 2014 14:03:37 -0400
| Newsgroups | gmane.comp.java.grinder.user |
|---|---|
| Message-ID | <CAP7Ca_kMK2E0jvWPiJFXnbtRRDcgXS8p2KaSF1NNd5QT7dsj7Q@mail.gmail.com> |
Can someone tell me how to fix this execution error : thread-0 [ run-0 ]: aborted run - Jython exception, <type 'exceptions.TypeError'>: page1() takes exactly 1 argument (2 given) [calling TestRunner] net.grinder.scriptengine.jython.JythonScriptExecutionException: <type 'exceptions.TypeError'>: page1() takes exactly 1 argument (2 given) result = ls.page1(self) File "./csaTest.py", line 30, in grinder_pt self.grinder_pt() File "./csaTest.py", line 51, in __call__ Here are my source files : ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ grinder-use mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/grinder-use
csaTest.py
(text/x-python-script, 2.2 KB)
'''
Created on Sep 3, 2014
@author: chanduramdowlathram
'''
# The Grinder 3.11
# HTTP script recorded by TCPProxy at Aug 26, 2014 2:09:18 PM
from LoadShell import LoadShell
from DLLookup import DLLookup
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 = HTTPPluginControl.getConnectionDefaults()
httpUtilities = HTTPPluginControl.getHTTPUtilities()
# To use a proxy server, uncomment the next line and set the host and port.
# connectionDefaults.setProxyServer("localhost", 8001)
ls=LoadShell();
class TestRunner:
def grinder_pt(self):
#ls=LoadShell();
result = ls.page1(self)
#result = LoadShell.page2(self)
#result = LoadShell.page3(self)
#result = LoadShell.page4(self)
#result = LoadShell.page5(self)
#grinder.sleep(3105)
#result = DLLookup.page6(self)
#result = DLLookup.page7(self)
#result = DLLookup.page8(self)
#result = DLLookup.page9(self)
#result = DLLookup.page10(self)
#result = DLLookup.page11(self)
#result = DLLookup.page12(self)
#result = DLLookup.page13(self)
#result = DLLookup.page14(self)
return result
def __call__(self):
"""Called for every run performed by the worker thread."""
self.grinder_pt()
# Instrument page methods.
Test(100, 'Page 1').record(ls.page1)
#Test(200, 'Page 2').record(LoadShell.page2)
#Test(300, 'Page 3').record(LoadShell.page3)
#Test(400, 'Page 4').record(LoadShell.page4)
#Test(500, 'Page 5').record(LoadShell.page5)
#Test(600, 'Page 6').record(DLLookup.page6)
#Test(700, 'Page 7').record(DLLookup.page7)
#Test(800, 'Page 8').record(DLLookup.page8)
#Test(900, 'Page 9').record(DLLookup.page9)
#Test(1000, 'Page 10').record(DLLookup.page10)
#Test(1100, 'Page 11').record(DLLookup.page6)
#Test(1200, 'Page 12').record(DLLookup.page12)
#Test(1300, 'Page 13').record(DLLookup.page13)
#Test(1400, 'Page 14').record(DLLookup.page14)
LoadShell.py
(text/x-python-script, 4.8 KB)
'''
Created on Sep 2, 2014
@author: chanduramdowlathram
'''
# The Grinder 3.11
# HTTP script recorded by TCPProxy at Aug 26, 2014 2:09:18 PM
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 = HTTPPluginControl.getConnectionDefaults()
httpUtilities = HTTPPluginControl.getHTTPUtilities()
# To use a proxy server, uncomment the next line and set the host and port.
# connectionDefaults.setProxyServer("localhost", 8001)
def createRequest(test, url, headers=None):
"""Create an instrumented HTTPRequest."""
request = HTTPRequest(url=url)
if headers: request.headers=headers
test.record(request, HTTPRequest.getHttpMethodFilter())
return request
log=grinder.getLogger()
log("Helloworld")
# These definitions at the top level of the file are evaluated once,
# when the worker process is started.
connectionDefaults.defaultHeaders = \
[ NVPair('Accept-Encoding', 'gzip, deflate'),
NVPair('Accept-Language', 'en-US,en;q=0.5'),
NVPair('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:31.0) Gecko/20100101 Firefox/31.0'), ]
headers0= \
[ NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'), ]
headers1= \
[ NVPair('Accept', '*/*'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'), ]
headers2= \
[ NVPair('Accept', 'application/json, text/plain, */*'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'), ]
headers3= \
[ NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),
NVPair('Referer', 'http://74.213.183.76:81/csa/css/app.css'), ]
headers4= \
[ NVPair('Accept', 'image/png,image/*;q=0.8,*/*;q=0.5'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'), ]
headers5= \
[ NVPair('Accept', 'image/png,image/*;q=0.8,*/*;q=0.5'),
NVPair('Referer', 'http://74.213.183.76:81/csa/css/app.css'), ]
headers6= \
[ NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),
NVPair('Cache-Control', 'no-cache'), ]
headers7= \
[ NVPair('Accept', 'text/css,*/*;q=0.1'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'),
NVPair('Cache-Control', 'no-cache'), ]
headers8= \
[ NVPair('Accept', '*/*'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'),
NVPair('Cache-Control', 'no-cache'), ]
url0 = 'http://74.213.183.76:81'
# Launch CSA App, http://74.213.183.76:81/csa/#/
request101 = createRequest(Test(101, 'GET /'), url0, headers0)
request102 = createRequest(Test(102, 'GET app.css'), url0)
request103 = createRequest(Test(103, 'GET app.js'), url0, headers1)
request104 = createRequest(Test(104, 'GET vendor.js'), url0, headers1)
request201 = createRequest(Test(201, 'GET welcome.html'), url0, headers2)
request301 = createRequest(Test(301, 'GET OpenSans-Regular-webfont.woff'), url0, headers3)
request302 = createRequest(Test(302, 'GET favicon.ico'), url0, headers0)
# Click NEXT CUSTOMER
request401 = createRequest(Test(401, 'GET search.html'), url0, headers2)
request402 = createRequest(Test(402, 'GET CSA_IconBttn_Home.png'), url0, headers4)
request403 = createRequest(Test(403, 'GET ajax-loader-light.gif'), url0, headers4)
request501 = createRequest(Test(501, 'GET btnGroup.html'), url0, headers2)
class LoadShell:
"""A TestRunner instance is created for each worker thread."""
# A method for each recorded page.
def page1(self):
"""GET / (requests 101-104)."""
result = request101.GET('/csa/')
grinder.sleep(57)
request102.GET('/csa/css/app.css', None,
( NVPair('Accept', 'text/css,*/*;q=0.1'),
NVPair('Referer', 'http://74.213.183.76:81/csa/'), ))
grinder.sleep(206)
request103.GET('/csa/js/app.js')
request104.GET('/csa/js/vendor.js')
self.token_key = \
httpUtilities.valueFromBodyURI('key') # 'value'
return result
def page2(self):
"""GET welcome.html (request 201)."""
result = request201.GET('/csa/components/welcome/welcome.html')
return result
def page3(self):
"""GET OpenSans-Regular-webfont.woff (requests 301-302)."""
result = request301.GET('/csa/fonts/OpenSans-Regular-webfont.woff')
grinder.sleep(81)
request302.GET('/favicon.ico')
return result
def page4(self):
"""GET search.html (requests 401-403)."""
result = request401.GET('/csa/components/search/search.html')
grinder.sleep(422)
request402.GET('/csa/images/CSA_IconBttn_Home.png')
request403.GET('/csa/images/ajax-loader-light.gif')
return result
def page5(self):
"""GET btnGroup.html (request 501)."""
result = request501.GET('/csa/components/search/templates/btnGroup.html')
return result