[Grinder-use] Parameter
Distributed load testing framework - Java, Jython, or Clojure scripts.
Brought to you by:
philipa
From: shantanu <sha...@ya...> - 2006-11-30 06:52:39
|
I have 2 fields username and password.I want to input different values for each thread. I have written the following code as provided in the grinder help # # testRandomise.py # import random import string class TestRandomise: def __init__(self, filename): self._users = [] infile = open(filename, "r") for line in infile.readlines(): self._users.append(string.split((line),',')) infile.close() def getUserInfo(self): "Pick a random (user, password) from the list." return random.choice(self._users) # # Test script. Originally recorded by the TCPProxy. # from testRandomise import TestRandomise tre = TestRandomise("users.txt") class TestRunner: def __call__(self): # Get user for this run. (user, passwd) = tre.getUserInfo() # ... # Use the user details to log in. tests[2002].POST('https://host:443/securityservlet', ( NVPair('functionname', 'Login'), NVPair('pagename', 'Login'), NVPair('ms_emailAddress', user), NVPair('ms_password', passwd), )). After executing i am getting error as follows grinder.py:149:[SyntaxWarning]: local name 'tre' in 'page4' shadows use as globa l in nested scopes 11/29/06 5:31:47 PM (process verisoft5-0): Error running worker process (ImportE rror: no module named testRandomise File "grinder.py", line 8, in ?) 11/29/06 5:31:48 PM (agent): finished In line 8 i have writen the import statement The file TestRandomise.py has the following code # # testRandomise.py # import random import string class TestRandomise: def __init__(self, filename): self._users = [] infile = open(filename, "r") for line in infile.readlines(): self._users.append(string.split((line),',')) infile.close() def getUserInfo(self): "Pick a random (user, password) from the list." return random.choice(self._users). Please suggest me some solution -- View this message in context: http://www.nabble.com/Parameter-tf2724637.html#a7598003 Sent from the Grinder - User mailing list archive at Nabble.com. |