会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
py-zhq
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
下一页
2022年7月8日
报错(token问题)Forbidden (CSRF cookie not set.):
摘要: 报错 Forbidden (CSRF cookie not set.): 解决办法 将settings.py里面的# 'django.middleware.csrf.CsrfViewMiddleware'注释掉即可 MIDDLEWARE = [ 'django.middleware.security
阅读全文
posted @ 2022-07-08 10:15 zhq9
阅读(787)
评论(0)
推荐(0)
2022年7月1日
顺序执行用例插件
摘要: 安装 pip install pytest-ordering 使用 import pytest @pytest.mark.run(order=2) def test_foo(): assert True @pytest.mark.run(order=1) def test_bar(): assert
阅读全文
posted @ 2022-07-01 15:47 zhq9
阅读(15)
评论(0)
推荐(0)
pytest 相关钩子
摘要: 初始化钩子 ###pytest_addoption 调用插件和conftest.py文件的初始化挂钩,添加命令行选项 import pytest def pytest_addoption(parser:pytest.Parser): parser.addoption("--xxxx",default
阅读全文
posted @ 2022-07-01 09:56 zhq9
阅读(63)
评论(0)
推荐(0)
2022年6月29日
pytest.ini配置
摘要: pytest.ini官网配置选项 注册标记标签 请注意,:标记名称之后的所有内容都是可选描述。 [pytest] markers = slow: marks tests as slow (deselect with '-m "not slow"') serial addopts 强制校验标签 没有注
阅读全文
posted @ 2022-06-29 18:03 zhq9
阅读(178)
评论(0)
推荐(0)
@pytest.mark.skipif
摘要: 介绍 pytest.mark.skipif可以根据条件判断是否执行该用例, 第一个参数传入条件 可以传入True/False如果条件应该被跳过或条件字符串 第二个参数是说明/原因 reason="2大于1" 有条件的跳过用例 import pytest @pytest.mark.skipif(1<2
阅读全文
posted @ 2022-06-29 16:21 zhq9
阅读(260)
评论(0)
推荐(0)
pytest.mark.skip 跳过测试用例
摘要: 介绍 您可以标记无法在某些平台上运行或您预计会失败的测试功能,以便 pytest 可以相应地处理它们并提供测试会话的摘要,同时保持测试套件绿色。 跳过意味着您希望测试仅在满足某些条件时才能通过,否则 pytest 应该完全跳过运行测试。常见的例子是跳过非 Windows 平台上的纯 Windows
阅读全文
posted @ 2022-06-29 15:22 zhq9
阅读(97)
评论(0)
推荐(0)
2022年6月28日
jmeter异常:Error in NonGUIDriver java.lang.IllegalArgumentException: Report generation requires csv output format, check 'jmeter.save.saveservice.output_format' property
摘要: 异常 Error in NonGUIDriver java.lang.IllegalArgumentException: Report generation requires csv output format, check 'jmeter.save.saveservice.output_forma
阅读全文
posted @ 2022-06-28 14:18 zhq9
阅读(655)
评论(0)
推荐(0)
2022年6月21日
pytest parametrize参数化标记
摘要: 介绍 parametrize装饰器可以对函数进行参数化,像用例相同场景不同数据的时候就可以使用它 函数参数化 import pytest @pytest.mark.parametrize("nub1,nub2,nub3",[[1,2,3],[2,2,4],[3,2,5]]) def test_01(
阅读全文
posted @ 2022-06-21 09:54 zhq9
阅读(45)
评论(0)
推荐(0)
2022年6月17日
内部 fixture capsys
摘要: 读取并返回到目前为止捕获的输出,重置内部缓冲区。 返回 将捕获的内容作为具有out和err 字符串属性的命名元组。 def test_output(capsys): print("hello") captured = capsys.readouterr() assert captured.out =
阅读全文
posted @ 2022-06-17 14:03 zhq9
阅读(37)
评论(0)
推荐(0)
2022年6月16日
fixtrue cache (cache 内置fixture)
摘要: cache fixture 也可以根据 request fixture关联出来 例如:request.config.cache.makedir 获取给定的name缓存路径,没有该目录就会创建, @pytest.fixture def mydata(cache): val = cache.makedi
阅读全文
posted @ 2022-06-16 18:34 zhq9
阅读(33)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
下一页
公告