我正在使用 multi-mechanize 和 urllib2 在网络服务器上运行示例
#!/usr/bin/env python
import urllib2
import time
import random
class Transaction(object):
def __init__(self):
pass
def run(self):
start_timer = time.time()
resp = urllib2.urlopen('http://192.168.16.114/1.html')
content = resp.read()
latency = time.time() - start_timer
self.custom_timers['Example_Homepage'] = latency
assert (resp.code == 200), 'Bad Response: HTTP %s' % resp.code
assert ('Example Web Page' in content), 'Text Assertion Failed'
if __name__ == '__main__':
trans = Transaction()
trans.run()
print trans.custom_timers
运行项目后,我可以看到每个交易的错误,但不确定是什么错误,因为我可以看到网络服务器正确响应请求,有人可以建议吗?
[root@dev1-proxy3 scripts]# multimech-run k1_testrun
user_groups: 2
threads: 6
[================100%==================] 30s/30s transactions: 23879 timers: 23879 errors: 23879
analyzing results...
transactions: 23888
errors: 23888
test start: 2013-01-26 12:59:23
test finish: 2013-01-26 12:59:53
created: ./k1_testrun/results/results_2013.01.26_12.59.23/results.html
done.