当前位置: 首页 > news >正文

phpcms安装/温州seo优化

phpcms安装,温州seo优化,jsp做的网站后台信息,海淀网站建设目录 引言 框架设计思路 项目结构 源码展示 核心主程序代码 运行结果 测试报告 引言 前面介绍了pytest框架一些基础知识与基本用法,掌握了一定基础后,我们可以进行项目实战,搭建pytest接口自动测试框架。 框架设计思路 画了一张草图&#xff…

目录

  引言

  框架设计思路

   项目结构

  源码展示

  核心主程序代码

  运行结果

  测试报告


  引言

  前面介绍了pytest框架一些基础知识与基本用法,掌握了一定基础后,我们可以进行项目实战,搭建pytest接口自动测试框架。

  框架设计思路

  画了一张草图,大家自行领会。

 

   项目结构

 

 

  源码展示

  将test_weatherapi.py测试用例源码附上,关键部分都有备注,知识点覆盖之前所讲的。

city = ['北京','上海','广州','深圳']
@allure.step('参数化请求数据: %s'% city)
def step_1():print("初始化数据")return city# city = ['北京','上海','广州','深圳']
@pytest.fixture(params=city)
def city_name(request):print("城市名称: %s"%request.param)return request.param@allure.epic('测试天气API接口'.center(30,'*'))
@allure.feature('测试模块')
@allure.suite('这是套件')
class TestWeather:"""测试模块httpbin"""def setup(self):"""所有用例执行前的条件"""self.conf = Config()self.data = Weather()self.test_assert = Assert.Assertions()self.request = Request.Request()self.results_list = Consts.RESULT_LISTself.logger = Log.MyLog()@allure.severity('normal')@allure.story('故事1:获取天气数据')@allure.title('获取单个城市的天气')@allure.description('获取深圳的天气')@allure.testcase('测试用例地址:www.***.com')@allure.issue('缺陷管理地址:https://www.zentao.net/')@allure.tag('这是tag')@pytest.mark.run(order=3)def test_001(self):"""测试httpbin接口:get方法"""# api:hosthost = self.conf.host_testreq_url = 'https://' + host# api:urlurls = self.data.url[0]# api:bodyparams = self.data.data[0]# api:headersheaders = self.data.header[0]print(host)print(req_url)print(urls)api_url = req_url + urlsresponse = self.request.get_request(url=api_url,data=params,header=headers)self.test_assert.assert_code(response['code'],200)print(response['code'])self.results_list.append('True')print(self.results_list)print('接口返回数据SSSS: %s'%response)self.logger.info('接口返回数据: %s' % response)@allure.severity('normal')@allure.story('故事2:获取天气数据')@allure.title('获取不同城市的天气')@allure.description('获取北上广深城市的天气')@allure.testcase('测试用例地址:www.***.com')@allure.issue('缺陷管理地址:https://www.zentao.net/')@pytest.mark.parametrize('city_name',city,indirect=True)@pytest.mark.run(order=2)def test_002(self,city_name):# step_1()host = 'wthrcdn.etouch.cn'req_url = 'http://' + hosturls = self.data.url[1]params = {'city':city_name}headers = self.data.header[1]api_url = req_url + urlsresponse = self.request.get_request(url=api_url,data=params,header=headers)self.test_assert.assert_code(response['code'],200)print('接口返回数据: %s'%response)self.logger.info('接口返回数据: %s'%response)self.results_list.append('True')print(self.results_list)

  核心主程序代码

if __name__ == '__main__':conf = Configs.Config()log = Log.MyLog()log.info('初始化配置文件, path=' + conf.conf_path)shell = Shell.Shell()#exp: 异地启动报告cmd2 = 'pytest -s -q  --alluredir  allure_report --clean-alluredir'cmd3 = 'allure serve allure_report'try:os.chdir(r"./testcase")  # 跳到报告路径下print(os.getcwd())shell.invoke(cmd2)shell.invoke_2(cmd3)# log.info(shell.invoke_2(cmd3))except Exception:log.error('异地启动失败,请检查环境配置')raiseelse:log.info("没有执行")

  运行结果

[2020-06-07 23:04:11] [INFO] [INFO 2020-06-07 23:04:11]初始化配置文件, path=C:\Users\Administrator\Desktop\pytest_testAPI\config\config.ini城市名称: 北京
接口返回数据: {'code': 200, 'body': {'data': {'yesterday': {'date': '6日星期六', 'high': '高温 28℃', 'fx': '东南风', 'low': '低温 18℃', 'fl': '<![CDATA[2级]]>', 'type': '晴'}, 'city': '北京', 'forecast': [{'date': '7日星期天', 'high': '高温 36℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 20℃', 'fengxiang': '南风', 'type': '多云'}, {'date': '8日星期一', 'high': '高温 38℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 26℃', 'fengxiang': '西南风', 'type': '阴'}, {'date': '9日星期二', 'high': '高温 30℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 21℃', 'fengxiang': '东北风', 'type': '阴'}, {'date': '10日星期三', 'high': '高温 34℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 21℃', 'fengxiang': '东南风', 'type': '晴'}, {'date': '11日星期四', 'high': '高温 34℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 22℃', 'fengxiang': '东南风', 'type': '小雨'}], 'ganmao': '感冒易发期,外出请适当调整衣物,注意补充水分。', 'wendu': '31'}, 'status': 1000, 'desc': 'OK'}, 'text': '{"data":{"yesterday":{"date":"6日星期六","high":"高温 28℃","fx":"东南风","low":"低温 18℃","fl":"<![CDATA[2级]]>","type":"晴"},"city":"北京","forecast":[{"date":"7日星期天","high":"高温 36℃","fengli":"<![CDATA[2级]]>","low":"低温 20℃","fengxiang":"南风","type":"多云"},{"date":"8日星期一","high":"高温 38℃","fengli":"<![CDATA[3级]]>","low":"低温 26℃","fengxiang":"西南风","type":"阴"},{"date":"9日星期二","high":"高温 30℃","fengli":"<![CDATA[2级]]>","low":"低温 21℃","fengxiang":"东北风","type":"阴"},{"date":"10日星期三","high":"高温 34℃","fengli":"<![CDATA[2级]]>","low":"低温 21℃","fengxiang":"东南风","type":"晴"},{"date":"11日星期四","high":"高温 34℃","fengli":"<![CDATA[2级]]>","low":"低温 22℃","fengxiang":"东南风","type":"小雨"}],"ganmao":"感冒易发期,外出请适当调整衣物,注意补充水分。","wendu":"31"},"status":1000,"desc":"OK"}', 'time_consuming': 65.801, 'time_total': 0.065801}
['True']
.城市名称: 上海
接口返回数据: {'code': 200, 'body': {'data': {'yesterday': {'date': '6日星期六', 'high': '高温 27℃', 'fx': '东北风', 'low': '低温 21℃', 'fl': '<![CDATA[3级]]>', 'type': '多云'}, 'city': '上海', 'forecast': [{'date': '7日星期天', 'high': '高温 28℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 22℃', 'fengxiang': '东南风', 'type': '阴'}, {'date': '8日星期一', 'high': '高温 29℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 23℃', 'fengxiang': '东南风', 'type': '晴'}, {'date': '9日星期二', 'high': '高温 27℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 24℃', 'fengxiang': '东南风', 'type': '阴'}, {'date': '10日星期三', 'high': '高温 27℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 23℃', 'fengxiang': '东南风', 'type': '大雨'}, {'date': '11日星期四', 'high': '高温 29℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 24℃', 'fengxiang': '东风', 'type': '多云'}], 'ganmao': '感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。', 'wendu': '23'}, 'status': 1000, 'desc': 'OK'}, 'text': '{"data":{"yesterday":{"date":"6日星期六","high":"高温 27℃","fx":"东北风","low":"低温 21℃","fl":"<![CDATA[3级]]>","type":"多云"},"city":"上海","forecast":[{"date":"7日星期天","high":"高温 28℃","fengli":"<![CDATA[3级]]>","low":"低温 22℃","fengxiang":"东南风","type":"阴"},{"date":"8日星期一","high":"高温 29℃","fengli":"<![CDATA[3级]]>","low":"低温 23℃","fengxiang":"东南风","type":"晴"},{"date":"9日星期二","high":"高温 27℃","fengli":"<![CDATA[3级]]>","low":"低温 24℃","fengxiang":"东南风","type":"阴"},{"date":"10日星期三","high":"高温 27℃","fengli":"<![CDATA[2级]]>","low":"低温 23℃","fengxiang":"东南风","type":"大雨"},{"date":"11日星期四","high":"高温 29℃","fengli":"<![CDATA[2级]]>","low":"低温 24℃","fengxiang":"东风","type":"多云"}],"ganmao":"感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。","wendu":"23"},"status":1000,"desc":"OK"}', 'time_consuming': 16.963, 'time_total': 0.016963}
['True', 'True']
.城市名称: 广州
接口返回数据: {'code': 200, 'body': {'data': {'yesterday': {'date': '6日星期六', 'high': '高温 29℃', 'fx': '西南风', 'low': '低温 24℃', 'fl': '<![CDATA[3级]]>', 'type': '小雨'}, 'city': '广州', 'forecast': [{'date': '7日星期天', 'high': '高温 28℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 26℃', 'fengxiang': '东南风', 'type': '大雨'}, {'date': '8日星期一', 'high': '高温 29℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 26℃', 'fengxiang': '东南风', 'type': '阴'}, {'date': '9日星期二', 'high': '高温 31℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 26℃', 'fengxiang': '南风', 'type': '大雨'}, {'date': '10日星期三', 'high': '高温 32℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 26℃', 'fengxiang': '东南风', 'type': '小雨'}, {'date': '11日星期四', 'high': '高温 32℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 26℃', 'fengxiang': '南风', 'type': '小雨'}], 'ganmao': '感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。', 'wendu': '26'}, 'status': 1000, 'desc': 'OK'}, 'text': '{"data":{"yesterday":{"date":"6日星期六","high":"高温 29℃","fx":"西南风","low":"低温 24℃","fl":"<![CDATA[3级]]>","type":"小雨"},"city":"广州","forecast":[{"date":"7日星期天","high":"高温 28℃","fengli":"<![CDATA[2级]]>","low":"低温 26℃","fengxiang":"东南风","type":"大雨"},{"date":"8日星期一","high":"高温 29℃","fengli":"<![CDATA[3级]]>","low":"低温 26℃","fengxiang":"东南风","type":"阴"},{"date":"9日星期二","high":"高温 31℃","fengli":"<![CDATA[3级]]>","low":"低温 26℃","fengxiang":"南风","type":"大雨"},{"date":"10日星期三","high":"高温 32℃","fengli":"<![CDATA[3级]]>","low":"低温 26℃","fengxiang":"东南风","type":"小雨"},{"date":"11日星期四","high":"高温 32℃","fengli":"<![CDATA[3级]]>","low":"低温 26℃","fengxiang":"南风","type":"小雨"}],"ganmao":"感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。","wendu":"26"},"status":1000,"desc":"OK"}', 'time_consuming': 16.062, 'time_total': 0.016062}
['True', 'True', 'True']
.城市名称: 深圳
接口返回数据: {'code': 200, 'body': {'data': {'yesterday': {'date': '6日星期六', 'high': '高温 30℃', 'fx': '南风', 'low': '低温 26℃', 'fl': '<![CDATA[3级]]>', 'type': '中雨'}, 'city': '深圳', 'forecast': [{'date': '7日星期天', 'high': '高温 28℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 25℃', 'fengxiang': '南风', 'type': '中雨'}, {'date': '8日星期一', 'high': '高温 28℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 25℃', 'fengxiang': '东南风', 'type': '阴'}, {'date': '9日星期二', 'high': '高温 30℃', 'fengli': '<![CDATA[3级]]>', 'low': '低温 25℃', 'fengxiang': '东南风', 'type': '大雨'}, {'date': '10日星期三', 'high': '高温 31℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 28℃', 'fengxiang': '东南风', 'type': '小雨'}, {'date': '11日星期四', 'high': '高温 32℃', 'fengli': '<![CDATA[2级]]>', 'low': '低温 27℃', 'fengxiang': '东南风', 'type': '多云'}], 'ganmao': '感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。', 'wendu': '26'}, 'status': 1000, 'desc': 'OK'}, 'text': '{"data":{"yesterday":{"date":"6日星期六","high":"高温 30℃","fx":"南风","low":"低温 26℃","fl":"<![CDATA[3级]]>","type":"中雨"},"city":"深圳","forecast":[{"date":"7日星期天","high":"高温 28℃","fengli":"<![CDATA[3级]]>","low":"低温 25℃","fengxiang":"南风","type":"中雨"},{"date":"8日星期一","high":"高温 28℃","fengli":"<![CDATA[3级]]>","low":"低温 25℃","fengxiang":"东南风","type":"阴"},{"date":"9日星期二","high":"高温 30℃","fengli":"<![CDATA[3级]]>","low":"低温 25℃","fengxiang":"东南风","type":"大雨"},{"date":"10日星期三","high":"高温 31℃","fengli":"<![CDATA[2级]]>","low":"低温 28℃","fengxiang":"东南风","type":"小雨"},{"date":"11日星期四","high":"高温 32℃","fengli":"<![CDATA[2级]]>","low":"低温 27℃","fengxiang":"东南风","type":"多云"}],"ganmao":"感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。","wendu":"26"},"status":1000,"desc":"OK"}', 'time_consuming': 18.194, 'time_total': 0.018194}
['True', 'True', 'True', 'True']
.tianqiapi.com
https://tianqiapi.com
/api
200
['True', 'True', 'True', 'True', 'True']
接口返回数据SSSS: {'code': 200, 'body': {'cityid': '101280601', 'date': '2020-06-07', 'week': '星期日', 'update_time': '2020-06-07 22:45:12', 'city': '深圳', 'cityEn': 'shenzhen', 'country': '中国', 'countryEn': 'China', 'wea': '雨', 'wea_img': 'yu', 'tem': '26', 'tem1': '27', 'tem2': '25', 'win': '东南风 ', 'win_speed': '1级', 'win_meter': '小于12km/h', 'humidity': '96%', 'visibility': '17.6km', 'pressure': '999', 'air': '25', 'air_pm25': '25', 'air_level': '优', 'air_tips': '空气很好,可以外出活动,呼吸新鲜空气,拥抱大自然!', 'alarm': {'alarm_type': '', 'alarm_level': '', 'alarm_content': ''}}, 'text': '{"cityid":"101280601","date":"2020-06-07","week":"\\u661f\\u671f\\u65e5","update_time":"2020-06-07 22:45:12","city":"\\u6df1\\u5733","cityEn":"shenzhen","country":"\\u4e2d\\u56fd","countryEn":"China","wea":"\\u96e8","wea_img":"yu","tem":"26","tem1":"27","tem2":"25","win":"\\u4e1c\\u5357\\u98ce ","win_speed":"1\\u7ea7","win_meter":"\\u5c0f\\u4e8e12km\\/h","humidity":"96%","visibility":"17.6km","pressure":"999","air":"25","air_pm25":"25","air_level":"\\u4f18","air_tips":"\\u7a7a\\u6c14\\u5f88\\u597d\\uff0c\\u53ef\\u4ee5\\u5916\\u51fa\\u6d3b\\u52a8\\uff0c\\u547c\\u5438\\u65b0\\u9c9c\\u7a7a\\u6c14\\uff0c\\u62e5\\u62b1\\u5927\\u81ea\\u7136\\uff01","alarm":{"alarm_type":"","alarm_level":"","alarm_content":""}}', 'time_consuming': 338.721, 'time_total': 1.338721}
.
5 passed in 1.79sGenerating report to temp directory...
Report successfully generated to C:\Users\ADMINI~1\AppData\Local\Temp\8814248789759504727\allure-report
Starting web server...
Server started at <http://192.168.1.105:63005/>. Press <Ctrl+C> to exit

 

  测试报告

 

http://www.lbrq.cn/news/1364815.html

相关文章:

  • 上海 网站设计/sem数据分析
  • wordpress admin_init/晨阳seo顾问
  • 动态网站设计作业/零基础能做网络推广吗
  • 哪里有学习做网站的/西安网站搭建公司
  • 常德市 网站建设/百度免费推广有哪些方式
  • 网站seo具体怎么做/推广文案怎么写吸引人
  • 应聘软件开发工程师简历/技术优化seo
  • 湛江有哪些网站建设公司/爱站网长尾词挖掘工具
  • 郴州做网站的公司/百度营销登录平台
  • 开设赌场罪 网站开发/网络培训seo
  • 设计案例展示网站/杭州seo网站哪家好
  • 做民宿的有哪些网站/站长工具域名解析
  • 征婚网站上教人做恒指期货/怎么找需要做推广的公司
  • 网页设计制作一个餐饮网站/网络推广怎么做方案
  • 连城县建设局网站/如何制作网站二维码
  • 网站备案号在哪儿查询/成都seo优化外包公司
  • 企业网站申请流程/友情链接赚钱
  • 腾讯云网站备案流程图/网站推广方案模板
  • 建设企业网站作用/seo包年优化
  • www.网站建设/贴吧友情链接在哪
  • 开发门户网站需要注意什么/网络营销推广方式都有哪些
  • 网络推广是干嘛的可以做吗/中国seo排行榜
  • 留白的网站/淘宝指数转换工具
  • 大连网站设计哪个最好/官方网站怎么查询
  • 乌克兰集团网站建设/网站关键词优化方案
  • 深圳市光明建设发展集团网站/百度sem
  • 做软装什么网站可以/站长工具如何使用
  • 全站搜索/it培训机构排行榜
  • 做网站云服务期/如何做网销
  • 自己怎么弄网站/5000人朋友圈推广多少钱
  • C++-异常
  • spring boot开发中的资源处理等问题
  • 多租户字典管理系统完整设计
  • HCIE-Datacom题库_07_设备【道题】
  • 推荐系统学习笔记(八)其他召回通道
  • 更换KR100门禁读头&主机