python测试模块pytest之坑
来源:互联网 发布:jquery.checktree.js 编辑:程序博客网 时间:2024/06/05 01:08
pytest是pyhon测试代码模块,只要你安装了pytest就可以生成txt,xml,html等测试结果集,注意:生成html需要安装pytest-html模块。
pytest会寻找test或者test_开头的函数,Test开头的类去测试。我在使用pytest的时候就遇到了大坑,总结一下
很多教程都是这么教的:py.test test_class.py –html=.\report.html
他们的都能正常运行,然而我的报错了:
usage: py.test [options] [file_or_dir] [file_or_dir] [...]py.test: error: unrecognized arguments: --html=.\report.html inifile: None rootdir: C:\Users\LQ\Desktop\testPython
纳闷
用py.test -h查看参数,确实没找到–html这个参数,可是明明教程上的就是这么个呀,为什么呢
抱着试一试的想法,用了pytest.py -h命令试了一下,果然这里找到了–html的参数,原来使用pytest.py test_class.py –html=.\report.html这个命令,没错,执行成功了
总结:py.test能在cmd下输出详细的测试过程但不能输出html测试结果;pytest.py能输出测试结果到html以及其他的文档格式
最后:还是建议使用pytest.py命令比较好。
阅读全文
0 0
- python测试模块pytest之坑
- python 测试框架 pytest
- Python pytest测试
- 12.python开源——pytest自动化测试框架
- 【Pytest】python单元测试框架pytest简介
- 一个好用的python测试框架(pytest)及其CI设置
- 【开发也是好测试系列】(二)——pytest之fixture
- python zipfile模块测试
- python单元模块测试
- python -- 测试re模块
- 用pytest做服务端自动化协议测试
- python - pytest - Very easy sample in steps
- python里面Nose和pytest的区别
- Python模块之---random模块
- python模块之时间模块
- python模块之os模块
- python模块之JSON模块
- python的自动化测试模块
- 移动矩形代码和一个非常重要的windows消息队列机制的坑
- OpenGL_4:画一个长方形
- SQL case语句
- 1062. 最简分数(20)
- centos7搭建完nginx后禁用firewall防火墙和selinux
- python测试模块pytest之坑
- springmvc 之DispatcherServlet逻辑处理
- Solr的基本使用
- ios-Swift实现自定义输出
- Mex(线段树)
- PAT乙级1033
- 复习:全局变量、局部变量、静态全局变量、静态局部变量在内存中如何存储,有什么区别,栈和堆的区别等知识点(非原创)
- 六级_第四天
- 国庆出游 HihoCoder