摘要: 1. 新建两个object:User和School user.py school.py 2. 给对象创建factory 3.编写自定义Provider(如果没有Provider需求,可以跳过这个步骤) 4.使用 结果: 阅读全文
posted @ 2019-08-14 16:14 月色深潭 阅读(938) 评论(0) 推荐(0) 编辑
摘要: pytest官网 https://docs.pytest.org/en/latest/getting-started.html 官网推荐的plugin https://docs.pytest.org/en/latest/plugins.html#using-plugins allure对应pytes 阅读全文
posted @ 2019-08-14 15:45 月色深潭 阅读(244) 评论(0) 推荐(0) 编辑
摘要: conftest.py 执行结果: 可以从结果中看到每个case执行前,都执行了declass这个fixture,且每次都是重新调用。 (这种使用方法,从官方给出的例子来看,应该用于数据清理或准备比较合适。) 还支持引用多个fixture conftest.py 执行结果: 阅读全文
posted @ 2019-08-14 15:24 月色深潭 阅读(944) 评论(0) 推荐(0) 编辑
摘要: 执行命令: pytest -rA test_parametrizing.py 执行结果: 正常情况params参数不能动态取值的,如果需要动态取值,可以采用在params的序列值中放入函数的方法解决 在用例test_params2和test_params2_2的执行结果中可以看到,在scope为fu 阅读全文
posted @ 2019-08-14 14:48 月色深潭 阅读(2819) 评论(0) 推荐(0) 编辑
摘要: 上图是试验的目录结构 conftest.py:存放pytest fixture的文件 test_class.py:类测试文件 其它测试文件都是打印fixture的返回信息 下图是打印结果 结论: package的试验结果和预期有些出入,其它的作用范围大小关系为 function<class<modu 阅读全文
posted @ 2019-08-14 11:15 月色深潭 阅读(1429) 评论(3) 推荐(0) 编辑