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

网站建设者html网址打不开无法显示网页怎么办

网站建设者html,网址打不开无法显示网页怎么办,网站做动态虚线,做仓单的网站这里写目录标题一、pytest用法总结二、pytest.ini是什么三、改变运行规则pytest.inicheck_demo.py执行测试用例四、添加默认参数五、指定执行目录六、日志配置七、pytest插件分类八、pytest常用插件九、改变测试用例的执行顺序十、pytest并行与分布式执行十一、pytest内置插件h… 这里写目录标题一、pytest用法总结二、pytest.ini是什么三、改变运行规则pytest.inicheck_demo.py执行测试用例四、添加默认参数五、指定执行目录六、日志配置七、pytest插件分类八、pytest常用插件九、改变测试用例的执行顺序十、pytest并行与分布式执行十一、pytest内置插件hook体系十二、pytest插件开发1、pytest_collection_modifyitems2、pytest编写插件——添加命令行参数(***)conftest.pytest_option.py一、pytest用法总结 1、修改用例的命名规则 2、配置日志格式、比代码配置更方便 3、指定执行目录 4、排除搜索目录 5、添加标签防止运行过程报警告 6、添加默认参数 二、pytest.ini是什么 pytest.ini是pytest的配置文件 可以修改pytest的默认行为 不能使用任何中文字符包括汉字、空格、中文引号、中文冒号、中文注释 三、改变运行规则 执行check_开头和 test_开头的所有的文件后面一定要加* python_files check * test * 执行所有的以Test和Check开头的类 python_classes Test* Check* 执行所有以test_和check_开头的方法 python_functions test_* check_* pytest.ini pytest.ini中不能加注释 check_demo.py import pytest import loggingclass CheckDemo:def check_demo1(self):logging.info(这是demo1测试用例)assert 11def check_demo2(self):logging.info(这是demo1测试用例)assert 11def test_demo1(self):logging.info(这是demo1测试用例)assert 12执行测试用例 pytest check_demo.py四、添加默认参数 addopts -v -s 五、指定执行目录 testpaths demo1 忽略某些目录 norecursedirs demo1 test_demo 六、日志配置 七、pytest插件分类 外部插件pip install 插件 本地插件pytest自动发现机制conftest/py存放 内置插件代码内部的_pytest目录加载 八、pytest常用插件 pip install pytest-ordering控制用例执行顺序 pip install pytest-xdist分布式并发执行测试用例 pip install pytest-dependency控制用例的依赖关系 pip install pytest-rerunfailures用例失败重跑 pip install pytest-assume多重校验 pip install pytest-random-order用例随机执行 pip install pytest-html测试报告 九、改变测试用例的执行顺序 安装;pip install pytest-ordering 使用装饰器pytest.mark.run(ordernum)安装数字从小到大的顺序执行。 pytest默认从上到下执行测试用例 import pytestclass TestB:pytest.mark.run(order2)def test_c(self):passpytest.mark.run(order1)def test_d(self):pass执行测试用例 十、pytest并行与分布式执行 安装pip install xdist 注意用例多的时候效果明显多进程并发执行同时支持allure #!/usr/bin/env python # -*- coding: utf-8 -*- # Time : 2023/2/16 21:15 # Author : 杜兰特 # File : test_xdist.py import timeimport pytestclass TestC:def test_e(self):time.sleep(1)assert Truedef test_f(self):time.sleep(1)assert Truedef test_g(self):time.sleep(1)assert Truedef test_e1(self):time.sleep(1)assert Truedef test_f2(self):time.sleep(1)assert Truedef test_g3(self):time.sleep(1)assert True执行测试用例 -n auto电脑默认cpu核数 D:\pytest_projectpytest -n auto十一、pytest内置插件hook体系 1、hook函数名字固定 2、hook函数会被自动执行 3、执行是有先后顺序的 4、pytest定义了很多hook函数可以在不同阶段实现不同的功能 5、pytest有很多钩子函数 6、使用时直接编写函数体 十二、pytest插件开发 pytest_collection_modifyitems收集上来的测试用例实现定制化功能 解决问题: 自定义用例的执行顺序 解决编码问题(中文的测试用例名称) 自动添加标签 1、pytest_collection_modifyitems # 收集完测试用例 之后调用的hook函数 def pytest_collection_modifyitems(items):测试用例收集完成时将收集到的用例名name和用例标识nodeid的中文信息显示在控制台上print(items)#name用例的名字#nodeid测试用例的路径for item in items:item.nameitem.name.encode(utf-8).decode(unicode-escape)item._nodeiditem.nodeid.encode(utf-8).decode(unicode-escape)items.reverse()2、pytest编写插件——添加命令行参数(***) conftest.py #定义一个命令行参数 def pytest_addoption(parser):mygroup parser.getgroup(work) #group将下面所有的 option都展示在这个group下。mygroup.addoption(--env, #注册一个命令行选项default test, # 参数的默认值dest env, # 存储的变量 为属性命令可以使用option对象访问到这个值暂用不到help set your run env # 帮助提示 参数的描述信息)#如何针对传入的不同参数完成不同的逻辑处理 pytest.fixture(scopesession) def cmdoption(request):myenvrequest.config.getoption(--env,defaulttest)if myenv test:datapathdatas/test.yamlelif myenv dev:datapathdatas/env.yamlwith open(datapath) as f:datasyaml.safe_load(f)return myenv,datastest_option.py def test_addoption(cmdoption):print(cmdoption)如果命令行不传–env参数env环境默认为test env环境需要dev的环境数据命令行传入–env dev D:\pytest_project\demo_plugin1pytest test_option.py --env dev
http://www.dnsts.com.cn/news/68380.html

相关文章:

  • 宝安做棋牌网站建设哪家好网站用什么平台开发
  • 张家口远大建设集团网站遵义网站推广
  • 怎样做企业手机网站建设中国建筑官网电话
  • 平顶山网站关键词优化wordpress返回顶部插件
  • 怎么建商城网站吗哪些网站可以做驾考试题
  • 国内精品在线网站建设安徽省住房和城乡建设厅网站首页
  • 新万网站建设计算机网站建设体会
  • 做网站图注意事项做网站组织结构框架例子
  • 住房城乡建设网站查询用vps刷网站流量要怎么做
  • 农业建设信息网站有创意的公司名字
  • 网站ip地址查询网站建设销售ppt模板
  • 网站开发者调试模式织梦网站被攻击
  • 做网站效果吴江网站优化
  • 孵化器网站建设设计师入门必学软件
  • 网站建设推广需要多少钱软件网站开发合同
  • 别人帮做的网站怎么修改病句24小时学会网站建设pdf
  • 网上医疗和医院网站建设订阅号可以做微网站吗
  • 网站建设开发岗位职责网站托管做的好的公司
  • wordpress倒计时代码网站建设关键词排名优化
  • 中国建材工程建设协会网站wordpress 暴力
  • 建设银行官网站下载浙江省建设厅 网站是多少
  • wordpress中文主题站网站不备案怎么办
  • 福田的网站建设公司哪家好做一个网站多久
  • 搜索引擎排名网站天津建设工程交易中心网站
  • 中国建设银行黑龙江支行官方网站网站设计与建设论文
  • 安徽省交通运输厅门户网站邯郸做网站代理
  • 适合网站参加的培训班wordpress举报插件
  • 专业网站制作的费用北京公司注销流程及费用
  • 网站如何制作百度关键词热搜
  • 乐从网站制作dedecms做网站全教程