当前位置:网站首页>pytest 与 unittest 的区别
pytest 与 unittest 的区别
2022-08-09 13:06:00 【沉觞流年】
pytest 与 unittest 的区别
1、表达用例:
- unittest 通过定义一个类,继承unittest.TestCase
- pytest 直接定义类 / 函数
2、断言的表达:
- unittest:self.assertxxx()
- pytest:assert 表达式(结果为True-断言成功,结果为False-断言失败)
3、收集用例:
- unittest:TestLoader类+TestSuite类,discover收集用例
- pytest:自动收集用例
4、fixture:前置后置
- unittest:setUp&tearDown 继承至setUpClass&tearDownClass
- pytest:function(用例)→ class(测试类)→ Module(.py文件) → Session(会话)
5、插件
- unittest:无
- pytest:插件数量700+。如html插件、allure报告
边栏推荐
猜你喜欢
Explanation of RTSP protocol
利用信号灯和共享内存实现进程间同步通信
现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
GIN初探,环境安装
GIN file upload and return
搭建大型分布式服务(二)搭建会员服务
FFmpeg multimedia file processing (implementation of ffmpeg operation directory and list)
乐东消防救援大队应邀为干部开展消防安全培训
Unicom network management protocol block diagram
Uni - app - uview Swiper shuffling figure component, click on the links to jump (click to get the item after the row data, remove data operation)
随机推荐
FFmpeg多媒体文件处理(ffmpeg处理流数据的基本概念)
Q_06_01 Q#编程语言
ArcEngine(九)图形绘制
关于做2D游戏时,Canvas边界显示在Game窗口的问题
正则表达式-re模块
NC53 删除链表的倒数第n个节点
Map mixed density function and quantile added line
剑指 Offer 56 - II. 数组中数字出现的次数 II(位运算)
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
【奖励公示】第23期 2022年7月奖励名单公示:社区明星评选 | 新人奖 | 博客同步 | 推荐奖
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 13 Assignment
Final assignment of R language data analysis in a university
RTSP协议讲解
ArcEngine(八) 选择要素并高亮显示
An Offer 21. Adjust the array in order to make odd in even the front (loop invariant)
程序员的七夕怎么过?不会是写代码吧
陈强教授《机器学习及R应用》课程 第十六章作业
The FPGA - work summary recently
[极客大挑战 2019]Upload
Process/Thread related in Sandbox - 1