Grinder 对我来说是新的,我试图弄清楚如何摆脱这个错误:
我的 test.py 脚本:
import string
import random
from java.lang import String
from java.net import URLEncoder
from net.grinder.plugin.http import HTTPRequest
from net.grinder.common import GrinderException
log = grinder.logger.info
stat = grinder.statistics.forLastTest
SERVER = "http://www.google.com"
URI = "/"
class TestRunner:
def __call__(self):
requestString = "%s%s" % (SERVER, URI)
request = HTTPRequest()
result = request.GET(requestString)
if string.find(result.getText(), "SUCCESS") < 1:
stat.setSuccess(0)
我跑
java net.grinder.Console
java net.grinder.Grinder
在我的本地主机中。开始测试后,此消息不断弹出:
aborting process - Jython exception, <type 'exceptions.NameError'>: name 'grinder' is not defined [initialising test script]
net.grinder.scriptengine.jython.JythonScriptExecutionException: <type 'exceptions.NameError'>: name 'grinder' is not defined
log = grinder.logger.info
File "./test.py", line 8, in <module>
看起来我必须为这个“grinder.logger.info”包含一些 Grinder 模块,但我不知道我应该导入什么......
有什么提示吗?
提前致谢