pytest的使用
pytest也是一个第三方工具的包
也需要去下载pip3 install pytest -i 源地址
然后导入pyest,编写用例:每个用例都以test_开头
每个测试用例的方法test_开头,也
运行:可以运行指定的脚本(pytest test_01.py),也可以运行整个文件夹(PS:命令为:pytest 文件夹的名字)
这样就可以分模块管理用例了,让网页生成自动测试报告:
1、先安装allure第三方包:pip3 install allure
2、下载allure软件包,并配置环境变量,最后cm的输入allure查看
3、生成allure的测试结果:pytest ./ --alluredir=result(会生成一个名为result的文件夹)
4、停止终端
5、新建终端(并选择cmd),输入allure generate result -o report --clean
6、查看测试报告: allure open -h 127.0.0.1 -p 10086 report