【拉勾三期】python pytest 测试实战1

已修改:
1、测试数据存放数据文件
2、分隔测试正确、错误用例
3、预期内的异常用例用异常捕获机制判断
4、生成报告,添加指定feature、story

https://github.com/JuliaZxr/hogwarts_lg3_Yuki.git

作业完成的思路不错。
待改进
1、下图的teardown_class 写的不对,
image
2、数据最好存储在数据文件中。便于管理

加法/除法测试py文件在:pytest/test_calc_pytest.py
yaml数据文件在:pytest/data/calc.yml

https://github.com/niujiama/LilyGithub.git

作业完成 的不错,思路很完整。
用例设计的再全面一些。

作业完成的不错,思路很清晰。
一些需要注意的小问题:
1、目录结构划分一下,更便于维护。
2、除法分母为0的情况,如果抛出ZeroDivisionError 异常,说明是正确的,不需要手动再抛出异常了。

with pytest.raises(ZeroDivisionError) as exc_info:
                calc_result = self.calc.divide(a, b)

pytest实战一
有个问题地方不知道怎么写,如果怎么去判断传入的参数是数值,不是字符串
https://github.com/pengxiufang/hogwarts_lg3/tree/master/python_practice

https://github.com/ygl6532/testing/tree/master/calculator

已修改

https://github.com/lh75756/python/tree/master/homework/homework_calc

https://github.com/jijiangyongyou/win_happy/tree/master/xuexi_pytest

https://github.com/Vena-ww/MyPythonTest

https://github.com/zhaoxiaoshan405671811/hogwarts_demo/tree/master/Python_demo/demo_pytest

https://github.com/Lannal/pythonProject.git

https://github.com/youthtail/hogwarts_yhh/blob/master/pytest_2/test_practice3.py

  • pytest实战一,计算器加法、除法单元测试

https://github.com/LiJiaLin29/hogwarts

https://github.com/xiaomaolv60/python_practise.git

https://github.com/sunybee/homework3

https://github.com/he56jian/hgwz_test

https://github.com/gqxjones/MyprojectHogwarts/blob/master/testing/pytest.py

https://github.com/zz06212github/hogwarts_lun