您的位置:首页 > 编程语言 > Python开发

python 接口自动化测试(二)

2016-03-10 11:35 676 查看
代码实现

1.XlsEngine.py

#! /usr/bin/python
# coding:utf-8
import logging,time
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(filename)s[line:%(lineno)d] 【%(levelname)s】 %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename=r".\Log\Service"+time.strftime(r'%Y-%m-%d', time.localtime(time.time()))+".log",
filemode='a')
console = logging.StreamHandler()
logging.getLogger('suds.client').addHandler(console)

def writeLog(methodname,result):
'''写日志'''
content = methodname + "\n"
for item in result:
content=content+'\t|'+str(item)
if result.Success==False:
logging.error(content)

def writeException(msg):
'''写日志'''
logging.error("【Catch Exception】"+str(msg))


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: