-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yanchunhuo
committed
Apr 24, 2018
1 parent
23a274c
commit 4f31cb4
Showing
11 changed files
with
92 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
# 说明: | ||
# 基于excel的接口自动化测试: | ||
|
||
## 一、安装依赖库 | ||
* pip install -r requirements.txt | ||
|
||
## 二、使用方法 | ||
* 修改auto_testing_excel目录中的case.xlsx的用例 | ||
* 修改auto_testing_excel目录中的config.py的相关配置 | ||
* 安装xlrd/xlwt/requests | ||
* python \*/auto_testing_excel/test_main.py > myreport.html | ||
* python run.py > myreport.html | ||
|
||
## 三、软件 | ||
* unittest 单元测试 | ||
* HTMLTestRunner 将unittest结果生成html | ||
* requests http请求库 | ||
* xlrd 读excel | ||
* xlwt 写excel | ||
|
||
## 三、使用的软件 | ||
* unittest 单元测试 | ||
* HTMLTestRunner=0.8.2 将unittest结果生成html | ||
* requests=2.12.4 http请求 | ||
* xlrd=1.0.0 读excel | ||
* xlwt=1.1.2 写excel | ||
## 四、编码规范 | ||
* Python使用2.7版本 | ||
* 代码编写全部统一在Linux环境下进行 | ||
* 文件编码统一使用"-\*- coding:utf-8 -\*-" |
File renamed without changes.
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/python | ||
#-*- coding:utf-8 -*- | ||
''' | ||
该模块存放一些共用的修饰器 | ||
''' | ||
#日志修饰器 | ||
def log(func): | ||
def wrapper(*args,**kw): | ||
print '调用函数的参数为:',args,kw | ||
print '开始执行函数' | ||
func(*args,**kw) | ||
print '结束执行函数' | ||
return wrapper | ||
|
||
|
||
if __name__=='__main__': | ||
print "手术室" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/python | ||
#-*- coding:utf-8 -*- | ||
import uuid | ||
''' | ||
@description 获取一些资源 | ||
''' | ||
|
||
''' | ||
@description 获得唯一名称 | ||
@param preStr 加前缀 | ||
@return string | ||
''' | ||
def getUUID(preStr): | ||
if(preStr=='' or preStr is None): | ||
return 'autotesting_'+(str)(uuid.uuid1()) | ||
else: | ||
return 'autotesting_'+str(preStr)+'_'+(str)(uuid.uuid1()) | ||
|
||
''' | ||
@description 如果目录路径最后一位不是'/',则修改 | ||
@dirPath 需要修改的目录路径 | ||
@return string | ||
''' | ||
def amendDirPath(dirPath): | ||
if(dirPath[-1]!='/'): | ||
return dirPath+'/' | ||
return dirPath |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
requests==2.12.4 | ||
xlrd==1.0.0 | ||
xlutils==2.0.0 | ||
xlwt==1.1.2 | ||
xlwt==1.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters