Menu ▾ ▴

#254 TestRunner instance has no attribute 'token_v'

3.12
open
nobody
None
1
2015-11-23
2015-11-23
Li Liang
No

I have grinder set up and when i ran it, i got this error: net.grinder.scriptengine.jython.JythonScriptExecutionException: <type 'exceptions.attributeerror'="">: TestRunner instance has no attribute 'token_v'</type>

In my grinder.py, i have:

The Grinder 3.11

Base Grinder script

from java.io import File

from net.grinder.script import Test
from net.grinder.script.Grinder import grinder

import usecase01_mens_watches
import usecase02_search
import usecase03_women_watch_PDP
import usecase04_shopbybrand
import usecase09_preowned

class TestRunner:
def init(self):

    mod = (grinder.threadNumber % 10)
    if (grinder.threadNumber in range(0, 4)):
                    print "usecase01_mens_watches"
                    self.testRunner = usecase01_mens_watches.TestRunner()
    elif (grinder.threadNumber in range (4,6)):
                    print "usecase02_search"
                    self.testRunner = usecase02_search.TestRunner()
    elif (grinder.threadNumber in range (6,8)):
                    print "usecase03_women_watch_PDP"
                    self.testRunner = usecase03_women_watch_PDP.TestRunner()
    elif (grinder.threadNumber in range (8,9)):
                    print "usecase04_shopbybrand"
                    self.testRunner = usecase04_shopbybrand.TestRunner()
    else:
                    print "usecase09_flash_sales"
                    self.testRunner = usecase07_flash_sales.TestRunner()
def __call__(self):
    self.testRunner()

In my usecase01_mens_watches.py, i have things like this:
class TestRunner:
"""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('/', None,
( NVPair('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8'),
NVPair('Accept-Encoding', 'gzip, deflate'), ))

grinder.sleep(1086)
request102.GET('/instartlogic/nv/ii/week-178-4/loader/instart.js')

grinder.sleep(947)
self.token_v = \
  '11.19.2015'
request103.GET('/wcsstore/AuroraStorefrontAssetStore/css/ribbon.css' +
  '?v=' +
  self.token_v, None,
  ( NVPair('If-Modified-Since', 'Wed, 18 Nov 2015 03:03:05 GMT'),
    NVPair('If-None-Match', '\"3fe4a-393c-524c7e190ac40\"'), ))

grinder.sleep(111)
request104.GET('/wcsstore/AuroraStorefrontAssetStore/javascript/ig_welcome_mat.js' +
  '?v=' +
  self.token_v, None,
  ( NVPair('If-Modified-Since', 'Wed, 18 Nov 2015 00:55:08 GMT'),
    NVPair('If-None-Match', '\"3fe5e-36b0-524c617faf300\"'), ))

return result

...

Please help. Why would it throw no attribute 'token_v'. Any urgent help is highly appreciated.

Discussion


Log in to post a comment.