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

河源手机网站制作做房产必知的发布房源网站

河源手机网站制作,做房产必知的发布房源网站,工信部网站备案查询步骤,做网站服务器需要系统前言 平常我们手工测试用例非常多时#xff0c;比如有1千条用例#xff0c;假设每个用例执行需要1分钟。如果一个测试人员执行需要1000分钟才能执行完#xff0c;当项目非常紧急的时候#xff0c;我们会用测试人力成本换取时间成本#xff0c;这个时候多找个小伙伴把任务…前言 平常我们手工测试用例非常多时比如有1千条用例假设每个用例执行需要1分钟。如果一个测试人员执行需要1000分钟才能执行完当项目非常紧急的时候我们会用测试人力成本换取时间成本这个时候多找个小伙伴把任务分成2部分于是时间缩减一半。如果是十个人一起执行1000个用例理论上只需100分钟就能完成时间缩短到了1/10。大大节省的测试时间为项目节省了时间成本。 pytest 3.6.3 pytest-xdist 1.23.2 同样道理当我们测试用例非常多的时候一条条执行很显然会比较慢那么如何让测试用例并行执行呢这就是我们接下来要讲的pytest分布式执行插件pytest-xdist pytest-xdist cmd里面使用pip安装,目前版本号Version: 1.23.2 pip install pytest-xdist pip show pytest-xdist Name: pytest-xdist Version: 1.23.2 Summary: pytest xdist plugin for distributed testing and loop-on-failing modes Home-page: https://github.com/pytest-dev/pytest-xdist Author: holger krekel and contributors Author-email: pytest-devpython.org,holgermerlinux.eu License: MIT Location: e:\python36\lib\site-packages Requires: execnet, pytest-forked, six, pytestpytest-xdist官网地址【Home-page: https://github.com/pytest-dev/pytest-xdist】 该pytest-xdist插件扩展了一些独特的测试执行模式pytest 测试运行并行化如果有多个CPU或主机则可以将它们用于组合测试运行。会加快运行速度 --looponfail在子进程中重复运行测试。每次运行之后pytest会等待直到项目中的文件发生更改然后重新运行以前失败的测试。 重复此过程直到所有测试通过之后再次执行完整运行。 多平台覆盖您可以指定不同的Python解释器或不同的平台并在所有平台上并行运行测试。 在远程运行测试之前pytest有效地将您的程序源代码“rsyncs”到远程位置。报告所有测试结果并显示给您的本地终端。您可以指定不同的Python版本和解释器。 如果您想知道pytest-xdist如何在幕后工作可以看这里【OVERVIEW】 并行测试 多cpu并行执行用例直接加个-n参数即可后面num参数就是并行数量比如num设置为3 pytest -n 3 运行以下代码项目结构如下 web_conf_py是项目工程名称 │ conftest.py │ __init__.py │ ├─baidu │ │ conftest.py │ │ test_1_baidu.py │ │ test_2.py │ │ __init__.py │ ├─blog │ │ conftest.py │ │ test_2_blog.py │ │ __init__.py 代码参考 # web_conf_py/conftest.py import pytestpytest.fixture(scopesession) def start():print(\n打开首页)return yoyo# web_conf_py/baidu/conftest.py import pytestpytest.fixture(scopesession) def open_baidu():print(打开百度页面_session)# web_conf_py/baidu/test_1_baidu.py import pytest import timedef test_01(start, open_baidu):print(测试用例test_01)time.sleep(1)assert start yoyodef test_02(start, open_baidu):print(测试用例test_02)time.sleep(1)assert start yoyoif __name__ __main__:pytest.main([-s, test_1_baidu.py])# web_conf_py/baidu/test_2.py import pytest import timedef test_06(start, open_baidu):print(测试用例test_01)time.sleep(1)assert start yoyo def test_07(start, open_baidu):print(测试用例test_02)time.sleep(1)assert start yoyoif __name__ __main__:pytest.main([-s, test_2.py])# web_conf_py/blog/conftest.py import pytestpytest.fixture(scopefunction) def open_blog():print(打开blog页面_function)# web_conf_py/blog/test_2_blog.pyimport pytest import time def test_03(start, open_blog):print(测试用例test_03)time.sleep(1)assert start yoyodef test_04(start, open_blog):print(测试用例test_04)time.sleep(1)assert start yoyodef test_05(start, open_blog):跨模块调用baidu模块下的conftestprint(测试用例test_05,跨模块调用baidu)time.sleep(1)assert start yoyoif __name__ __main__:pytest.main([-s, test_2_blog.py]) 正常运行需要消耗时间7.12 seconds E:\YOYO\web_conf_pypytesttest session starts platform win32 -- Python 3.6.0, pytest-3.6.3, py-1.5.4, pluggy-0.6.0 rootdir: E:\YOYO\web_conf_py, inifile: plugins: xdist-1.23.2, metadata-1.7.0, html-1.19.0, forked-0.2 collected 7 itemsbaidu\test_1_baidu.py .. [ 28%] baidu\test_2.py .. [ 57%] blog\test_2_blog.py ... [100%] 7 passed in 7.12 seconds 设置并行运行数量为3消耗时间3.64 seconds大大的缩短了用例时间 E:\YOYO\web_conf_pypytest -n 3test session starts platform win32 -- Python 3.6.0, pytest-3.6.3, py-1.5.4, pluggy-0.6.0 rootdir: E:\YOYO\web_conf_py, inifile: plugins: xdist-1.23.2, metadata-1.7.0, html-1.19.0, forked-0.2 gw0 [7] / gw1 [7] / gw2 [7] scheduling tests via LoadScheduling ....... [100%]7 passed in 3.64 seconds 测试报告 使用pytest-xdist插件也能生成html报告,完美支持pytest-html插件 pytest -n 3 --htmlreport.html --self-contained-html 最后感谢每一个认真阅读我文章的人礼尚往来总是要有的虽然不是什么很值钱的东西如果你用得到的话可以直接拿走 这些资料对于【软件测试】的朋友来说应该是最全面最完整的备战仓库这个仓库也陪伴上万个测试工程师们走过最艰难的路程希望也能帮助到你
http://www.hkea.cn/news/14517211/

相关文章:

  • 电子类网站建设需要多少钱企业网站的功能主要有
  • 卖东西的网站怎么建设毕节地区建设网站
  • 12306的网站建设吴桥网站建设价格
  • 温州企业自助建站系统车票在线制作网站
  • 厦门网站建设哪家好雄安建设投资集团网站
  • 网站建设公司 中企动力公司店铺装修公司怎么找
  • 批量网站建设html成品模板
  • 专业做鞋子网站有哪些网站 备案 时间
  • 联科网站建设020网站开发多少钱
  • 建设银行黄陂支行网站苏州网站建设哪里好
  • 做背景图获取网站wordpress怎么改字体大小
  • 菜鸟教程网站开发江阴市住房与建设局网站
  • 大理网站制作网络营销推广引流方法
  • 我的世界做神器指令网站设计公司官网首页
  • 中山精品网站建设行情网站开发企划书
  • 小型企业网站如何建设设计师应该关注的网站
  • 网站设置二级域名做网站商城前景怎么样
  • 为什么网站之有首页被收录该产品在英文站及多语言网站
  • 成都做营销型网站公司起名自动生成器
  • 徐州市建设局网站郑州一建集团有限公司电话
  • 本地数据库搭建网站南沙区交通和建设局网站
  • 新网站怎么发外链重庆妇科医院排名前十名
  • 义乌百度网站制作网站编辑步骤有哪些
  • 北京怎样做企业网站百度推广开户多少钱一个月
  • 做外汇网站做什么类型网站好营销型网站建设 案例
  • 班级网站建设的内容优惠网站建设
  • 政务网站集约化建设大连做网站多少钱
  • 沙朗做网站公司设计广告设计
  • 昆明猫咪网站建设公司app开发企业网站建设
  • 空调公司网站建设怎么自己做直播网站吗