python 接口自动化测试(二)
2016-03-10 11:35
676 查看
代码实现
1.XlsEngine.py
View Code
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
相关文章推荐
- python 接口自动化测试(一)
- python迭代器与生成器详解
- python 发送安全邮件
- fibs输出不太对
- Python基础
- Python的multiprocessing模块学习
- Python import List
- python Upload Ftp
- Python文件处理
- python用来压缩目录的脚本
- python进行Base64编码和解码
- Python多线程学习
- mac下python2和python3的共存
- python按行读取文件
- Python不是内部或外部命令的解决办法
- Python -- Python知识结构
- Python&Eclipse环境搭建
- Python装饰器
- python标准日志模块logging的使用方法
- 【零基础入门学习Python笔记006】Python之常用操作符