- 博客(5)
- 收藏
- 关注
原创 mac上安装allure
直接使用:brew install allure报Error:openjdk:Calling`cellar`inabottleblockisdisabled!Use`brewstyle--fix`ontheformulatoupdatethestyleoruse`sha256`witha`cellar:`argumentinstead.没找到解决办法还是直接下载源码吧:https://github.com/allure-fram...
2021-06-24 17:58:51 414 1
原创 pytest笔记(四)-skip和xfail
Skip and xfailskip 意为着你的测试只有在满足某些条件时才能通过,否则pytest应该跳过运行testpytest计数并分别列出skip和xfail的测试,默认情况下,不会显示skipped或xfailed测试的详细信息,你可以使用-r选项去查看Skipping the function跳过test最简单的方式就是使用skip装饰器,并传递一个reason参数@pytest.mark.skip(reason='skip function')def test_1():
2021-04-20 18:09:23 185 2
原创 pytest笔记(三)-fixture
Fixtures 根据官方文档所述, 可以把一个test 分成4个步骤:Arrange Act Assert CleanupArrange 就是为我们test准备的,这就意味着“act”之外的一切事情,可以准备对象,启动/终止服务,将记录录入数据库,甚至定义要查询的URl等等而fixtures 就是所属“Arrange”中的步骤和数据,就是test所需要的的一切事情我们可以通过@pytest.fixture来装饰一个函数为fixture,如下例:import ...
2021-04-19 18:04:50 100
原创 pytest笔记(二)—Assert and Assert fail
Assertpytest使用标准的python assert 来验证测试中预期值和实际值就像下面的例子一样:def test_assert(): assert 3 == 4结果:pytest支持展示自定义异常的信息def test_assert(): assert 1 == 2, "1 is not equal to 2"结果:异常断言(Assertions about expected exceptions)如果为了写一个关于引发异常的ass
2021-03-29 15:54:06 543
原创 pytest笔记(一)—安装与运行
Pytest--安装与创建运行Install pytest命令行运行:pip install -U pytest查看版本:pytest --versionCreate your first test创建一个简单的test function:#content of test_func.pydef func(x): return x + 2def test_func(): assert func(3) == 4...
2021-03-17 11:19:06 141 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人