【Pytest】使用pytest时测试文件的命令规范

it2025-03-29  5

测试文件命名规范

编写pytest测试样例py文件非常简单,只需要按照下面的规则:

测试文件以test_开头(以_test结尾也可以),注意必须有下划线_测试类以Test开头,并且不能带有 init 方法测试函数以test_开头断言使用基本的assert即可

参考链接: https://blog.csdn.net/df0128/article/details/91043150 https://www.jianshu.com/p/a754e3d47671 https://blog.csdn.net/qq_19004627/article/details/89471337

pytest官方英文文档 https://pypi.org/project/pytest/

推荐书籍 https://www.zhihu.com/question/279903589/answer/410195802

最新回复(0)