当前位置:网站首页>unittest单元测试框架
unittest单元测试框架
2022-06-29 18:29:00 【是乔乔啊】
背景
unittest也称为PyUnit,是借鉴Java中JUnit框架产生。
unittest使我们具备创建测试用例、测试套件、测试夹具的能力。
组成
- Test Fixture(测试夹具):可以定义在单个或多个测试执行之前的准备工作和测试执行之后的清理工作。
- Test Case(测试用例):unittest中执行测试的最小单元。
- Test Suite(测试套件):一个测试套件是多个测试或测试用例的集合,是针对被测程序对应功能和模块创建的一组测试,一个测试套件内的测试用例将一起执行。
- Test Runner(测试执行器):测试执行器负责测试执行调度并且生成测试结果给用户。
- Test Report(测试报告):所有用例的执行通过结果,以及整体运行状况和运行时间的汇总。

一般情况下,unittest测试可以分为以下三部分:
- Arrane:初始化测试的前置条件,包含初始化被测试的对象、相关配置和依赖。
- Act:用来执行功能操作。
- Assert:用来校验实际结果和预期结果是否一致。
边栏推荐
- 剑指 Offer 34. 二叉树中和为某一值的路径-dfs法
- MySQL -connector/j driver download
- 程序员资源推荐指南
- CentOS 7.5 install MySQL 8.0.27---yum
- 什么是多范式编程语言,其中的“多范式”是什么意思?
- Request header field XXXX is not allowed by access control allow headers in preflight response
- WBF:检测任务NMS后虑框新方式?
- 山东大学项目实训(八)设计轮播图进入页面
- Redis (I) -- getting started with redis (2) -- redis data type
- PostGIS generate graphic cut
猜你喜欢

山东大学项目实训(七)添加导航栏选择城市

js文本粒子动态背景

Error building SqlSession问题

Apache InLong百万亿级数据流处理

Machine learning 7-Support vector machine

Svg circle drawing path animation

svg画圆路径动画

Up to 81.98%! Announcement of undergraduate study rate of more than 100 "double first-class" Universities

1. 使用STM32CubeMX建立STM32G030C8T6项目工程

The table ‘table_name‘ is full 异常排查及解决方案
随机推荐
How to use an oak camera as a webcam?
6.29 simulation summary
Adobe Premiere foundation - cool text flash (14)
Servlet student management system (Mengxin hands-on version)
JDBC Codes connexes
My first experience of remote office | community essay solicitation
The strategy of convertible bonds -- - (cake sharing, premium, forced redemption, downward revision, double low)
Panda Parkour JS games code
jdbc_相关代码
细说GaussDB(DWS)复杂多样的资源负载管理手段
【网络是怎么连接的】第三章 探索集线器,交换机和路由器
Meta agent model can be migrated to resist attacks
Machine learning 8-artificial neural network
Travel card "star picking" hot search first! Stimulate the search volume of tourism products to rise
Elegant writing controller (parameter verification + unified exception handling)
Machine learning 7-Support vector machine
Basis of data analysis -- prediction model
centos 7.5安装mysql 8.0.27----yum
山东大学项目实训(七)添加导航栏选择城市
The table ‘table_name‘ is full 异常排查及解决方案