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“包含一些研磨器模块,但我就是不知道我应该导入什么……..。
有什么提示吗?
提前感谢
发布于 2013-02-12 07:32:17
您从grinder导入项目,而不是grinder本身,请尝试
import grinder.logger.info
import grinder.statistics.forLastTest也可以是net.grinder.logger.info和net.grinder.statistics.forLastTest如果是这种情况,那么您的代码将需要更改以适应从grinder到net.grinder的更改
发布于 2013-10-23 19:43:04
您尚未导入研磨机。
from net.grinder.script.Grinder import grinder现在再试一次。
https://stackoverflow.com/questions/14822837
复制相似问题