当前位置:网站首页>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报告
边栏推荐
猜你喜欢

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)

How to solve the 0x80070005 error when the computer is reinstalled and the system is restored

PO、DO、TO、VO、DO、DTO、DAO、POJO都是什么?

蓝桥历届真题-蛇形填数

Anta and Huawei Sports Health jointly verify the champion running shoes and lead Chinese sports with innovation

Jenkins API groovy calling practice: Jenkins Core Api & Job DSL to create a project

5G China unicom repeater network management protocol real-time requirements

音频基础学习——声音的本质、术语与特性

微服务+微信小程序实现社区服务

面试攻略系列(三)-- 高级开发工程师面试问些啥?
随机推荐
read stream special attention
陈强教授《机器学习及R应用》课程 第十五章作业
How to solve the 0x80070005 error when the computer is reinstalled and the system is restored
剑指 Offer 43. 1~n 整数中 1 出现的次数(递归、数学)
NC7 买卖股票的最好时机(一)
Microsoft 10/11 命令行打开系统设置页(WUAP,!WIN32)
5G Unicom Network Management Design Ideas
Q_07 词汇表
基于 R 语言的判别分析介绍与实践 LDA和QDA
七夕力扣刷不停,343. 整数拆分(剑指 Offer 14- I. 剪绳子、剑指 Offer 14- II. 剪绳子 II)
昇腾AI开发者创享日南京站!一起CANN机器狗+AI机械臂实现硬核智慧救援!燃爆现场~
Q_06_05 文件结构
GIN a preliminary study, the environment is installed
NC15 求二叉树的层序遍历
FFmpeg相机花屏花图问题解决方法
RobotFramework 之 资源文件
FFMPEG多媒体文件处理(ffmpeg文件的删除与重命名)
The sword refers to the offer, cuts the rope 2
FPGA - Summary of bugs in ISE (in update)
01_iTween_第一天--小球抛物线