def __call__(self): #metronom.getToken() httpUtilities = HTTPPluginControl.getHTTPUtilities() currentTestData = TestRunner.randomTestData() #testUrl = 'https://robertsrg--tileserver.leidoslabs.com/tileserver/%s?skipcache' % currentTestData[TestRunner.TESTDATA_FILENAME_INDEX] testUrl = 'https://robertsrg--tileserver.leidoslabs.com/tileserver/%s' % currentTestData[ TestRunner.TESTDATA_FILENAME_INDEX] # grinder.logger.info("testUrl = %s" % testUrl) expectedSize = long( currentTestData[TestRunner.TESTDATA_FILESIZE_INDEX]) result = request1.GET(testUrl, (), (httpUtilities.basicAuthorizationHeader( 'tileservertest', 'T1leserver!!'), )) resultData = result.getData() # grinder.logger.info('result.getStatusCode() = %d len(resultData) = %d expectedSize = %d' % (result.getStatusCode(), len(resultData), expectedSize)) # print 'result.getStatusCode() = %d len(resultData) = %d expectedSize = %d' % (result.getStatusCode(), len(resultData), expectedSize) if ((result.getStatusCode() != 200) or (resultData is None) or (len(resultData) != expectedSize)): grinder.statistics.forLastTest.setSuccess(0)
# The Grinder 3.4 # HTTP script recorded by TCPProxy at Jan 24, 2011 1:53:12 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) # These definitions at the top level of the file are evaluated once, # when the worker process is started. connectionDefaults.defaultHeaders = \ [ NVPair('Accept-Language', 'en-us,en;q=0.5'), NVPair('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'), NVPair('Accept-Encoding', 'gzip,deflate'), NVPair('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13'), ] headers0= \ [ NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'), ] headers1= \ [ NVPair('Accept', 'image/png,image/*;q=0.8,*/*;q=0.5'), NVPair('Referer', 'http://localhost:8000/oib/login'), ] headers2= \ [ NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),
# -*- coding: latin-1 -*- # The Grinder 3.11 # HTTP script recorded by TCPProxy at Dec 18, 2015 2:50:19 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("supercars-tomcat:8080", 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 # These definitions at the top level of the file are evaluated once, # when the worker process is started. connectionDefaults.defaultHeaders = \ [ NVPair('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'), NVPair('Accept-Encoding', 'gzip, deflate'), NVPair('Accept-Language', 'en-us'), ] headers0= \ [ NVPair('Accept', '*/*'),