run.api
作者:互联网
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : liu wenhe
# @File : run.py
# @Time : 2021/5/5 21:51
from tools.http_request import HttpRequest
from tools import do_excel
import os
def run(dataa,COOKIE=None):
for item in dataa:
print("正在测试的用例是:{0}".format(item["title"]))
res = HttpRequest().http_request(item["url"], eval(item['data']), item["http_method"], COOKIE)
if res.cookies:
COOKIE=res.cookies
print("请求的结果是:{0}".format(res.json()))
do_excel.Get_excel("test_date/new.xlsx", "Sheet").write_back(item["case_id"]+1,str(res.json()))
dataa = do_excel.Get_excel("test_date/new.xlsx", "Sheet").doget_d()
run(dataa)
标签:run,excel,dataa,item,api,COOKIE,res 来源: https://www.cnblogs.com/huaiyuanyide/p/14736995.html