1第一步:创建开发编写模块,单元测试模块
2第二步:
前提:需要安装
pytest
和
pytest-html(
生成
html
测试报告)
pip install pytest
和
pip install pytest-html
先是安装pytest (pip install pytest )
安装成功
2.1 pytest 生产测试报告
2.1.1 类名不按照规则写,把类名写进方法中,照样可以运行
2.1.3 -s 使用
2.2 要下载pytest-html模块(有网前提)
2.3 pytest 生成测试报告
2.3.1 只想执行里面其中的一个方法(copy 里面的路径)
2.3.2 通过断言验证 执行错误时候是显示 F
2.3.3如果类中方法都想要执行
测试报告显示结果
3.1 pytest的扩充
3.1.1 -x 出现一条测试用例失败就退出测试
3.1.2 跳过第一个方法test01,去执行下面的方法
测试报告上显示结果