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

网站开发方案怎么写企业营销培训课程

网站开发方案怎么写,企业营销培训课程,网站备案管局审核,dhl网站做形式发票1 什么是分布式测试? 在进行本文之前,先了解些基础知识,什么是分布式测试?分布式测试:是指通过局域网和Internet,把分布于不同地点、独立完成特定功能的测试计算机连接起来,以达到测试资源共享…

1 什么是分布式测试?

  • 在进行本文之前,先了解些基础知识,什么是分布式测试?
  • 分布式测试:是指通过局域网和Internet,把分布于不同地点、独立完成特定功能的测试计算机连接起来,以达到测试资源共享、分散操作、集中管理、协同工作、负载均衡、测试过程监控等目的的计算机网络测试。
  • 通俗的讲:分布式测试 就是活太多,一个人干费时间,那就让多个人一起干,节省了资源和时间。

2 为什么要进行分布式测试?

2.1 场景1:自动化测试场景

自动化测试时,我们有很多用例,比如2000条用例,按照顺序执行,每条用例执行1分钟,那需要2000分钟;

什么概念?2000分钟就30多个小时,如果是冒烟测试,估计还没人工跑的快;

还有,如果是线上发布,跑完2000条用例就太浪费时间了;

那如果我们让我们让用例分布式执行,是不是可以节省很多时间?

2.2 场景2:性能测试场景
  • 如果数据量很大,我们使用1台压测机,可能并发压力过大;

  • 那就需要选择使用多台压测机(比如Jmeter的 Agent/负载机);

  • 这样也是一种分布式压测或者分布式性能测试场景。

所以总结来说,其实就是为了提升效率和质量。

3 分布式测试有什么特点?

特点说明
网格化多节点互联互通,可资源共享
分布性地域和计算机上,协同工作、负载均衡、可扩展性、高可用性
开放性可移植性、可互操作性、可伸缩性、易获得性
实时性各种信息都必须是实时的
动态性测试过程对象和活动动态映射
处理不确定性具有处理不确定性的能力
容错及安全性容错能力强,可靠性高、安全性好

4 分布式测试关键技术是什么?

技术点要求
分布式环境获取全局状态,能够方便地监视和操纵测试过程;集中式的分布式策略。
分布式环境下的节点通信稳定的通信环境;适合用基于消息通信的方式来实现。
测试任务调度静态调度、动态调度和混合调度。

5 分布式执行用例的前置条件是什么?

  • 用例之间是独立且没有依赖关系,完全独立运行;

  • 用例执行没有顺序,随机顺序都能正常执行;

  • 每个用例都能重复运行,运行结果不会影响其他用例。

6 pytest-xdist安装

  • pytest-xdist让自动化测试用例分布式执行,节省测试时间,属于进程级别的并发;

  • 使用以下方法安装:

pip3 install pytest-xdist
C:\Users\Administrator>pip3 install pytest-xdist
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: pytest-xdist in d:\python37\lib\site-packages (1.31.0)
Requirement already satisfied: six in d:\python37\lib\site-packages (from pytest-xdist) (1.15.0)
Requirement already satisfied: execnet>=1.1in d:\python37\lib\site-packages (from pytest-xdist) (1.8.0)
Requirement already satisfied: pytest>=4.4.0in d:\python37\lib\site-packages (from pytest-xdist) (6.2.4)
Requirement already satisfied: pytest-forked in d:\python37\lib\site-packages (from pytest-xdist) (1.1.3)
Requirement already satisfied: apipkg>=1.4in d:\python37\lib\site-packages (from execnet>=1.1->pytest-xdist) (1.5)
Requirement already satisfied: toml in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (0.10.2)
Requirement already satisfied: attrs>=19.2.0in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (20.3.0)
Requirement already satisfied: colorama in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (0.4.4)
Requirement already satisfied: atomicwrites>=1.0in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (1.4.0)
Requirement already satisfied: pluggy<1.0.0a1,>=0.12in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (0.13.1)
Requirement already satisfied: py>=1.8.2in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (1.10.0)
Requirement already satisfied: importlib-metadata>=0.12in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (2.1.1)
Requirement already satisfied: packaging in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (20.8)
Requirement already satisfied: iniconfig in d:\python37\lib\site-packages (from pytest>=4.4.0->pytest-xdist) (1.1.1)
Requirement already satisfied: zipp>=0.5in d:\python37\lib\site-packages (from importlib-metadata>=0.12->pytest>=4.4.0->pytest-xdist) (1.2.0)
Requirement already satisfied: pyparsing>=2.0.2in d:\python37\lib\site-packages (from packaging->pytest>=4.4.0->pytest-xdist) (2.4.7)

7 pytest-xdist的优势

  • 测试运行并行化;

  • 在子进程中重复运行测试;

  • 可指定不同的Python解释程序或不同的平台,并行运行测试。

8 pytest-xdist的使用

8.1 普通执行
import pytest
import timeclass TestCase01():def test_case_01(self):time.sleep(1)print("case01$$$$$$$$$$$$$$$$$$$$$")def test_case_02(self):time.sleep(1)print("case02$$$$$$$$$$$$$$$$$$$$$")def test_case_03(self):time.sleep(1)print("case03$$$$$$$$$$$$$$$$$$$$$")def test_case_04(self):time.sleep(1)print("case04$$$$$$$$$$$$$$$$$$$$$")def test_case_05(self):time.sleep(1)print("case05$$$$$$$$$$$$$$$$$$$$$")def test_case_06(self):time.sleep(1)print("case06$$$$$$$$$$$$$$$$$$$$$")class TestCase02():def test_case_07(self):time.sleep(1)print("case07$$$$$$$$$$$$$$$$$$$$$")def test_case_08(self):time.sleep(1)print("case08$$$$$$$$$$$$$$$$$$$$$")def test_case_09(self):time.sleep(1)print("case08$$$$$$$$$$$$$$$$$$$$$")if __name__ == '__main__':pytest.main(["-s", "test_xdist.py"])

执行结果如下,使用了9.14s:

test_xdist.py::TestCase01::test_case_01 
test_xdist.py::TestCase01::test_case_02 
test_xdist.py::TestCase01::test_case_03 
test_xdist.py::TestCase01::test_case_04 
test_xdist.py::TestCase01::test_case_05 
test_xdist.py::TestCase01::test_case_06 
test_xdist.py::TestCase02::test_case_07 PASSED                           [ 11%]case01$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 22%]case02$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 33%]case03$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 44%]case04$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 55%]case05$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 66%]case06$$$$$$$$$$$$$$$$$$$$$
PASSED                           [ 77%]case07$$$$$$$$$$$$$$$$$$$$$test_xdist.py::TestCase02::test_case_08 PASSED                           [ 88%]case08$$$$$$$$$$$$$$$$$$$$$test_xdist.py::TestCase02::test_case_09 PASSED                           [100%]case08$$$$$$$$$$$$$$$$$$$$$============================== 9 passed in9.14s ==============================
8.2 上述代码分布式执行:
  • 执行命令:

pytest -s -n auto test_xdist.py
  • 结果如下,用时4.51s,可见分布式执行后大大缩短了测试时间:

(venv) F:\pytest_study\test_case\test_j>pytest -s -n auto test_xdist.py
============================================ test session starts =============================================
platform win32 -- Python 3.7.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: F:\pytest_study, configfile: pytest.ini
plugins: allure-pytest-2.8.12, assume-2.4.3, cov-2.8.1, forked-1.1.3, html-2.0.1, metadata-1.8.0, ordering-0.6,repeat-0.9.1, rerunfailures-10.3, xdist-1.31.0
gw0 [9] / gw1 [9] / gw2 [9] / gw3 [9] / gw4 [9] / gw5 [9] / gw6 [9] / gw7 [9]
.........
============================================= 9 passed in4.51s ==============================================
8.3 指定CPU运行数量
  • -n auto:可以自动检测到系统的CPU核数;

  • 使用auto利用了所有CPU来跑用例;

  • 也可以指定使用几个CPU来跑用例:

  1. # x为cpu个数

  2. pytest -s -n x

  • 如下可以看到使用两个CPU来跑用例时长为6.27s:

(venv) F:\pytest_study\test_case\test_j>pytest -s -n 2 test_xdist.py
============================================ test session starts =============================================
platform win32 -- Python 3.7.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: F:\pytest_study, configfile: pytest.ini
plugins: allure-pytest-2.8.12, assume-2.4.3, cov-2.8.1, forked-1.1.3, html-2.0.1, metadata-1.8.0, ordering-0.6,repeat-0.9.1, rerunfailures-10.3, xdist-1.31.0
gw0 [9] / gw1 [9]
.........
============================================= 9 passed in6.27s ==============================================
8.4 与pytest-html一起使用
  • 命令如下:

pytest -s -n auto --html=report.html --self-contained-html
  • 运行结果:

pytest -s -n auto test_xdist.py --html=report.thml --self-contained-htm
l
gw0 [9] / gw1 [9] / gw2 [9] / gw3 [9] / gw4 [9] / gw5 [9] / gw6 [9] / gw7 [9]
.........
------------------ generated html file: file://F:\pytest_study\test_case\test_j\report.thml ------------------
============================================= 9 passed in4.68s ==============================================

8.5 让pytest-xdist按照指定顺序执行
  • pytest-xdist执行默认是无须的;

  • 可通过 --dist 参数来控制顺序;

参数说明
--dist=loadscope同一个模块module下的函数和同一个测试类class下的方法来分组
--dist=loadfile同一个文件名来分组
8.6 pytest-xdist如何保持session执行一次
  • pytest-xdist没有内置的支持来确保会话范围的夹具仅执行一次;

  • 可使用FileLock方法仅仅产生一次fixture数据:

import pytest
from filelock import FileLock@pytest.fixture(scope="session")
def login():print("====登录===")with FileLock("session.lock"):name = "zhang"password= "123456"# web ui自动化# 声明一个driver,再返回# 接口自动化# 发起一个登录请求,将token返回都可以这样写yield name, passwordprint("====退出====")

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!  


文章转载自:
http://dinnconormocytic.ssfq.cn
http://dinncosingultation.ssfq.cn
http://dinncolobscouse.ssfq.cn
http://dinncoradiumize.ssfq.cn
http://dinncoskidder.ssfq.cn
http://dinncobegat.ssfq.cn
http://dinncothioether.ssfq.cn
http://dinncovii.ssfq.cn
http://dinncosimulcast.ssfq.cn
http://dinncodripping.ssfq.cn
http://dinncoinstructor.ssfq.cn
http://dinncoperidotite.ssfq.cn
http://dinncobierkeller.ssfq.cn
http://dinncoclinometer.ssfq.cn
http://dinncocarminative.ssfq.cn
http://dinncotycoonate.ssfq.cn
http://dinncosialogogic.ssfq.cn
http://dinncotocology.ssfq.cn
http://dinncoconvivialist.ssfq.cn
http://dinncoacquirability.ssfq.cn
http://dinncoplatter.ssfq.cn
http://dinncosemipostal.ssfq.cn
http://dinncoarf.ssfq.cn
http://dinncocordwain.ssfq.cn
http://dinncoviscus.ssfq.cn
http://dinncopervasive.ssfq.cn
http://dinncopileum.ssfq.cn
http://dinncoplaything.ssfq.cn
http://dinncofelid.ssfq.cn
http://dinncorotproof.ssfq.cn
http://dinncodredging.ssfq.cn
http://dinncosalariat.ssfq.cn
http://dinncoabidjan.ssfq.cn
http://dinncostenciller.ssfq.cn
http://dinncoposseman.ssfq.cn
http://dinncocriminalistics.ssfq.cn
http://dinncobonny.ssfq.cn
http://dinncofleming.ssfq.cn
http://dinncowelchman.ssfq.cn
http://dinnconoodle.ssfq.cn
http://dinnconeurochemical.ssfq.cn
http://dinncodeterminedly.ssfq.cn
http://dinncoautoecism.ssfq.cn
http://dinncomesophile.ssfq.cn
http://dinncoevangeline.ssfq.cn
http://dinncobutterwort.ssfq.cn
http://dinncoaeroview.ssfq.cn
http://dinncolocally.ssfq.cn
http://dinncoastrid.ssfq.cn
http://dinncoalbata.ssfq.cn
http://dinncoargand.ssfq.cn
http://dinncoundertake.ssfq.cn
http://dinncophysiognomy.ssfq.cn
http://dinncoourself.ssfq.cn
http://dinncodopester.ssfq.cn
http://dinncosuperempirical.ssfq.cn
http://dinncomesenchyme.ssfq.cn
http://dinncocathodal.ssfq.cn
http://dinncoenable.ssfq.cn
http://dinncoague.ssfq.cn
http://dinncofallibilism.ssfq.cn
http://dinnconumeroscope.ssfq.cn
http://dinncoheliotropin.ssfq.cn
http://dinncoaerocraft.ssfq.cn
http://dinncovinculum.ssfq.cn
http://dinncomisallocation.ssfq.cn
http://dinnconucleochronometer.ssfq.cn
http://dinncocerebellar.ssfq.cn
http://dinncoofficialism.ssfq.cn
http://dinnconocake.ssfq.cn
http://dinncomnemotechnics.ssfq.cn
http://dinncoutopia.ssfq.cn
http://dinncocreature.ssfq.cn
http://dinncokincob.ssfq.cn
http://dinncocartagena.ssfq.cn
http://dinncosynovectomy.ssfq.cn
http://dinncopolyxena.ssfq.cn
http://dinncosystematization.ssfq.cn
http://dinncoplage.ssfq.cn
http://dinncoapa.ssfq.cn
http://dinncoobscurantism.ssfq.cn
http://dinncodecolorimeter.ssfq.cn
http://dinncokoulibiaca.ssfq.cn
http://dinncobecalmed.ssfq.cn
http://dinncohurley.ssfq.cn
http://dinncobmv.ssfq.cn
http://dinncotransprovincial.ssfq.cn
http://dinncodiocese.ssfq.cn
http://dinncopmpo.ssfq.cn
http://dinncohydraemia.ssfq.cn
http://dinncopolychaete.ssfq.cn
http://dinncopremiss.ssfq.cn
http://dinncoexplosive.ssfq.cn
http://dinnconearctic.ssfq.cn
http://dinncomellitum.ssfq.cn
http://dinncopappoose.ssfq.cn
http://dinncoresinify.ssfq.cn
http://dinncospecifically.ssfq.cn
http://dinncocatrigged.ssfq.cn
http://dinncoroofed.ssfq.cn
http://www.dinnco.com/news/112758.html

相关文章:

  • 买奢侈品代工厂做的产品的网站名怎么做网站教程视频
  • php网络公司网站源码如何做网络销售产品
  • 做百度手机网站快速排优化设计电子课本下载
  • 深圳单位名称和单位地址惠州seo关键字优化
  • 宝塔可以做二级域名网站么软文发布软件
  • 山东企业网站建设哪家好微指数官网
  • 伊春网站建设怎样申请自己的电商平台
  • 做视频网站需要什么条件百度搜索引擎的使用方法
  • 网站建设开票多少个点个人怎么做推广
  • 百度手机模板网站seo页面优化的方法
  • 工厂怎么做网站东莞市优速网络科技有限公司
  • 16岁做分期网站河南seo推广
  • 门户网站建设 工具html网页制作模板
  • 做网站前景怎样拉新任务接单放单平台
  • 昆仑万维做网站百度一下照片识别
  • 创建网站的过程电子商务平台建设
  • wordpress post插件2022网站seo
  • 网站如何做数据库网站seo课程
  • 凡客网上商城优化模型
  • 免费网站空间女人长春网站建设方案推广
  • 菏泽住房和城乡建设局网站网站推广关键词工具
  • seo网站关键词优化排名百度广告投诉电话客服24小时
  • 怎么看网站是什么程序做的企业站seo价格
  • 省建设厅网站合同备案用户名做一个简单的网站需要多少钱
  • 网站建设后应该干什么网页怎么搜索关键词
  • 网站开发项目管理步骤谷歌网页版
  • 网站建设 采集百度指数的主要用户是
  • 有哪些做特卖的网站有哪些百度关键字
  • 腾讯云网站搭建流程百度推广是什么
  • 我做中医培训去哪个网站找学员互联网营销策划是做什么的