2017-06-04 20:52:17 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
# @Time : 2017/6/4 20:15
|
|
|
|
|
# @Author : lileilei
|
2017-06-17 16:22:59 +08:00
|
|
|
# @File : test_case.py
|
2017-06-04 20:52:17 +08:00
|
|
|
from Interface.testFengzhuang import TestApi
|
2017-06-09 21:17:12 +08:00
|
|
|
from Public.get_excel import datacel
|
2017-06-17 16:22:59 +08:00
|
|
|
from Public.tsest_log import log_re
|
2017-06-06 11:05:50 +08:00
|
|
|
listid,listkey,listconeent,listurl,listfangshi,listqiwang,listname=datacel()
|
2017-08-03 13:03:33 +08:00
|
|
|
from Public.panduan import assert_in
|
2017-06-17 16:22:59 +08:00
|
|
|
title='测试日志'
|
|
|
|
|
log_can=log_re(title)
|
2017-08-01 21:39:11 +08:00
|
|
|
def testinterface():
|
|
|
|
|
list_pass = 0
|
|
|
|
|
list_fail = 0
|
|
|
|
|
list_json = []
|
|
|
|
|
listrelust=[]
|
|
|
|
|
for i in range(len(listurl)):
|
|
|
|
|
api=TestApi(url=listurl[i],key=listkey[i],connent=listconeent[i],fangshi=listfangshi[i])
|
|
|
|
|
apicode=api.getcode()
|
|
|
|
|
apijson=api.getJson()
|
|
|
|
|
log_can.info_log('inputdata> 参数:%s, url:%s ,返回:%s,预期:%s'%(listconeent[i],listurl[i],apijson,listqiwang[i]))
|
2017-08-03 13:03:33 +08:00
|
|
|
assert_re=assert_in(asserqiwang=listqiwang[i],fanhuijson=apijson)
|
|
|
|
|
if assert_re=='pass':
|
2017-08-01 21:39:11 +08:00
|
|
|
list_json.append(apijson)
|
|
|
|
|
listrelust.append('pass')
|
|
|
|
|
list_pass += 1
|
|
|
|
|
else:
|
|
|
|
|
list_fail+=1
|
|
|
|
|
listrelust.append('fail')
|
|
|
|
|
list_json.append(apijson)
|
|
|
|
|
return listrelust,list_fail,list_pass,list_json
|