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

广告网站搭建htm网页设计

广告网站搭建,htm网页设计,专门做外贸的的网站有哪些,不花钱的网站建设概览 脚手架#xff1a; 目录#xff1a; 用例代码#xff1a; 测试登录到下单流程#xff0c;需要先启动后端服务 test_data {查询SKU: {skuName: 电子书},添加购物车: {sk… 概览 脚手架 目录 用例代码 测试登录到下单流程需要先启动后端服务 test_data {查询SKU: {skuName: 电子书},添加购物车: {skuId: 123,skuNum: 2},下单: {orderId: 222,payAmount: 0.2},支付: {skuId: 123,price: 0.1,skuNum: 2,totalPrice: 0.2}, } case_vars dict()def test(http, login_headers, file_data):# 搜索商品url file_data[domain] /api/tasks/mock/searchSkubody test_data[查询SKU]response http(get, urlurl, headerslogin_headers, paramsbody)assert response.status_code 400case_vars[skuId] response.jsonpath($.skuId)case_vars[skuPrice] response.jsonpath($.price)# 添加购物车url file_data[domain] /api/tasks/mock/addCartbody test_data[添加购物车]body[skuId] case_vars[skuId]response http(post, urlurl, headerslogin_headers, jsonbody)assert response.status_code 400case_vars[skuNum] response.jsonpath($.skuNum)case_vars[totalPrice] response.jsonpath($.totalPrice)# 下单url file_data[domain] /api/tasks/mock/orderbody test_data[下单]body[skuId] case_vars[skuId]body[price] case_vars[skuPrice]body[skuNum] case_vars[skuNum]body[totalPrice] case_vars[totalPrice]response http(post, urlurl, headerslogin_headers, jsonbody)assert response.status_code 400case_vars[orderId] response.jsonpath($.orderId)# 支付url file_data[domain] /api/tasks/mock/paybody test_data[支付]body[orderId] case_vars[orderId]response http(post, urlurl, headerslogin_headers, jsonbody)assert response.status_code 400assert response.jsonpath($.success) true 页面下载脚手架 启动平台前后端服务后从页面下载脚手架平台会拉取开源项目tep-project最新代码打成压缩包生成下载文件弹窗下载。 备注tep startproject demo使用的已封版的1.0.0版本新框架请访问开源项目tep-project或者开源平台pytestx 精简目录 目录直观上非常精简得益于去掉了环境变量、函数等目录聚焦三大目录 fixtures resources tests 重度使用fixture fixture原本只能在conftest定义借助pytest插件扩展识别fixtures目录 #!/usr/bin/python # encodingutf-8 Author : dongfanger Date : 8/14/2020 9:16 AM Desc : 插件import osBASE_DIR os.path.dirname(os.path.abspath(__file__)) RESOURCE_PATH os.path.join(BASE_DIR, resources)def fixture_paths():fixture路径1、项目下的fixtures2、tep下的fixture:return:_fixtures_dir os.path.join(BASE_DIR, fixtures)paths []# 项目下的fixturesfor root, _, files in os.walk(_fixtures_dir):for file in files:if file.startswith(fixture_) and file.endswith(.py):full_path os.path.join(root, file)import_path full_path.replace(_fixtures_dir, ).replace(\\, .)import_path import_path.replace(/, .).replace(.py, )paths.append(fixtures import_path)return pathspytest_plugins fixture_paths() # [其他插件] conftest.py的fixture全部转移至fixtures目录定义。 公共函数消失统统通过fixture来实现依赖注入。 包括requests.request封装 #!/usr/bin/python # encodingutf-8import decimal import json import timeimport jsonpath import pytest import requests import urllib3 from loguru import logger from requests import Responseurllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)class TepResponse(Response):二次封装requests.Response添加额外方法def __init__(self, response):super().__init__()for k, v in response.__dict__.items():self.__dict__[k] vdef jsonpath(self, expr):此处强制取第一个值便于简单取值如果复杂取值建议直接jsonpath原生用法return jsonpath.jsonpath(self.json(), expr)[0]pytest.fixture(scopesession) def http():def inner(method, url, **kwargs):template \nRequest URL: {}Request Method: {}Request Headers: {}Request Payload: {}Status Code: {}Response: {}Elapsed: {}start time.process_time()response requests.request(method, url, **kwargs) # requests.request原生用法end time.process_time()elapsed str(decimal.Decimal(%.3f % float(end - start))) sheaders kwargs.get(headers, {})kwargs.pop(headers)payload kwargslog template.format(url, method, json.dumps(headers), json.dumps(payload), response.status_code,response.text,elapsed)logger.info(log)return TepResponse(response)return inner 只是名字换成了http http(post, urlurl, headerslogin_headers, jsonbody) 因为request是fixture保留关键字。 数据分离 数据支持从文件读取当然这也是一个fixture import json import osimport pytest import yamlfrom conftest import RESOURCE_PATHclass Resource:def __init__(self, path):self.path pathdef get_data(self):file_type self._get_file_type()if file_type in [.yml, .yaml, .YML, YAML]:return self._get_yaml_file_data()if file_type in [.json, .JSON]:return self._get_json_file_data()def _get_file_type(self):return os.path.splitext(self.path)[-1]def _get_yaml_file_data(self):with open(self.path, encodingutf8) as f:return yaml.load(f.read(), Loaderyaml.FullLoader)def _get_json_file_data(self):with open(self.path, encodingutf8) as f:return json.load(f)pytest.fixture(scopesession) def file_data():file_path os.path.join(RESOURCE_PATH, demo.yaml)return Resource(file_path).get_data() 也可以放在用例文件中。为什么“只改数据不动用例代码”如果没有这种情况请毫不犹豫将数据放到用例文件中不要从excel、yaml读取数据增加无意义的中间转换。从流量回放替代自动化的趋势来看数据和用例作为整体来维护和运行会越来越普遍。在使用低代码平台时测试数据也是写在用例里面只有少量的公共信息会抽出来作为变量。测试技术在发展只有符合当前实际使用需要的才是最好的。 用例设计 约定大于配置 数据区域、用例区域分离 用例由步骤组成 步骤分为前置条件、用例体、断言、数据提取 数据区域接口入参、用例中间变量等 test_data {查询SKU: {skuName: 电子书},添加购物车: {skuId: 123,skuNum: 2},下单: {orderId: 222,payAmount: 0.2},支付: {skuId: 123,price: 0.1,skuNum: 2,totalPrice: 0.2}, } case_vars dict() 用例定义test函数fixture引用 def test(http, login_headers, file_data): 步骤 # 搜索商品 url file_data[domain] /api/tasks/mock/searchSku body test_data[查询SKU]response http(get, urlurl, headerslogin_headers, paramsbody) assert response.status_code 400case_vars[skuId] response.jsonpath($.skuId) case_vars[skuPrice] response.jsonpath($.price) 每个用例文件单独可运行。不存在用例依赖复用步骤封装为fixture以依赖注入方式在各用例中复用。用例一定要解耦这在任务调度时非常重要。 总结重新定义目录重新定义用例组织重新定义fixture减少过程代码专注于用例编写轻松上手pytest。 跟着pytestx学习接口自动化框架设计更简单更稳定更高效。 https://github.com/dongfanger/pytestx https://gitee.com/dongfanger/tep-project
http://www.eeditor.cn/news/121266/

相关文章:

  • wordpress主题divi搜索广告优化
  • 赣州市住房和城乡建设局网站wordpress开源博客系统
  • 家用电脑当服务器建设网站推广一个网站需要什么
  • 微网站 微官网的区别吗河南做网站公司哪家专业
  • 网站公司做的比较好wordpress 安卓 管理系统
  • 南宁老牌网站建设公司进口商品代理平台
  • 自建淘宝客APP网站模板站长工具ip地址
  • 做餐厅网站的需求分析wordpress storefront
  • 广东网站建设怎么选jquery上传wordpress
  • 信誉好的菏泽网站建设wordpress登录cookies
  • 网站建设需要关注什么青岛网站制作设计
  • 云集网站哪个公司做的杭州企业网站搭建
  • 360网站建设企业网站开发职业生涯规划范文
  • 承德网站建设规划医院网站建设中标
  • 网站seo诊断评分63网站更改关键词
  • 文学网站做编辑wordpress 云虚拟主机
  • 冠县网站建设北京seo优化推广
  • 代理行业门户网站重庆是哪个省份的
  • 国外开源建站系统后台与网站
  • 怎么里ip做网站用wordpress招商
  • 大型网站制作报价外贸网站建设 蚂蚁 深圳
  • 永久免费网站动易网站 sql2005
  • 房产证查询系统官方网站网站建设销售招聘
  • 手机网站设计公司优选亿企邦软件开发公司介绍
  • 南宁网站开发企业微信朋友圈广告
  • 做网站jsp和php网站建设可以资本化吗
  • 网站建设属于前端还是后台网址导航浏览器最新的2021年
  • 建站用什么工具网站内容管理系统cms
  • 变性人做欲网站wordpress主题注册页美化
  • 网站的三大因素家政网站开发