自动化测试
文章平均质量分 58
软件自动化测试相关内容
z917185537
这个作者很懒,什么都没留下…
展开
-
pytest并发执行用例方案
经过上面的折腾终于解决了windows上使用pytest-parallel的问题,但是始终要去修改pytest-parallel中的内容,决定改为使用pytest-xdist,安装最新版本的pytest-xdist , 安装后执行即可 , 发现pytest-xdist会导致scope=session的fixture设置失效,即导致每个用例都会执行一次此fixture,正常情况是只需要执行一次的,详见session失效的解决办法。原创 2024-05-12 22:22:45 · 418 阅读 · 0 评论 -
通过pytest-xdist插件并发执行用例时, scope=session的fixture会运行多次问题的解决方案
在UI自动化项目中,使用的是pytest + playwright, 需要实现同一个用户只登录一次的,所以在conftest.py中定义了一个scope=session的fixture,然后在此fixture中实现了系统登录,在非并发模式下执行的时候,能保证同一个用户只登录一次,但是并发执行的时候每个case都会执行登录。原创 2024-05-12 22:22:17 · 370 阅读 · 1 评论 -
pytest-parallel包报错Can‘tpickle local object ‘pytest_addoption.<locals>.label_type.
【代码】pytest-parallel包报错Can‘tpickle local object ‘pytest_addoption.<locals>.label_type.原创 2024-04-08 09:12:54 · 210 阅读 · 0 评论 -
自动化测试--验证邮件内容
创建访问凭证credentials.json。是自定义方法,分别是获取时间和获取文件。其中DateFormat 和。要访问gmail先要去。原创 2023-11-03 16:58:46 · 205 阅读 · 0 评论 -
playwright: 全局修改页面等待超时时间
set_default_timeout设置的时间对所有接受timeout参数的方法都有效。原创 2023-02-09 22:47:19 · 4414 阅读 · 1 评论 -
playwright 脚本调试
编写playwright脚本的过程中会涉及到脚本的调试,调试的话主要用Playwright Inspector来进行调试,可以通过以下几种方式来调试。原创 2022-09-07 23:41:22 · 1709 阅读 · 0 评论 -
cypress自动化测试-代码调试
cypress f12 console下cy.pause()cy.debug()原创 2021-09-01 00:01:24 · 384 阅读 · 0 评论 -
cypress自动化-编写第一个测试用例
编写一个自动化测试步骤大致为:1、访问网站2、进行一系列操作3、断言结果现设计一个用例如下:1、访问csdn个人中心2、查看cypress分栏下显示的文章数是否正确(通过访问该分栏获得文章数来进行验证)新建文件test.js代码如下describe('test the csdn',()=>{ it('the article num',()=>{ cy.visit('https://blog.csdn.net/z917185537') cy.get(':nth-chil原创 2021-08-17 10:41:20 · 257 阅读 · 0 评论 -
allure安装
自动安装window上通过scoop进行安装安装scoop要求:PowerShell 5 + , .NET Framework 4.5+已安装查看powershell版本:打开powershell,输入$PSVersionTable在powershell中执行:Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')或者简短的命令iwr -useb get.scoop.s原创 2021-07-24 09:25:53 · 388 阅读 · 2 评论 -
pytest中参数化方法,并且根据执行的命令进行动态参数化
@pytest.mark.parametrize多个参数,list格式,每个元素间的值以元组表示参数值组合添加用例标识添加 name标记,可通过-m name来执行指定用例#coding=utf-8import pytesttestdata = [ (3, 4, -1), (6,3, 3),]@pytest.mark.parametrize("a,b,expected", testdata)def test_timedistance_v0(a, b, expect原创 2021-07-21 21:14:02 · 3327 阅读 · 1 评论 -
pytest执行用例时返回异常ModuleNotFoundError: No module named ‘***‘
问题描述通过pytest执行用例会返回异常:ModuleNotFoundError: No module named '***'通过python -m pytest执行用例可以正常执行通过pycharm进行run对应的用例文件,可以正常执行项目目录结构和test_dir.py文件中的内容如下问题出现原因python -m pytest和pytest区别:python -m pytest会把当前项目的目录添加到sys.path(指定模块的搜索路径)中通过pycharm进行运行的时候原创 2021-07-21 21:10:32 · 4344 阅读 · 4 评论 -
pytest自动发现用例命名规则和修改默认命名规则
自动发现用例命名规则未指定目录和文件,则是当前目录下递归搜索test_.py或者_test.py文件测试类名必须以Test开头,并且测试类中不能包含__init__方法测试函数或方法以test为前缀修改默认规则在项目所在目录添加pytest.ini文件,并且内容如下[pytest]python_files = check_*.pypython_classes = Checkpython_functions = *_check check_* test_* *_testpytho原创 2021-07-17 23:44:50 · 550 阅读 · 2 评论 -
unittest框架基础和报告输出
setUptearDownsetUpClasssetUpModuleAPIunittest.TestCaseunittest.IsolatedAsyncioTestCaseunittest.FunctionTestCaseunittest.TestSuiteunittest.TestLoaderunittest.TestResultunittest.TextTestResultunittest.TextTestRunner断言跳过测试预计的失败expectedFailure()原创 2021-07-11 18:21:34 · 572 阅读 · 3 评论