selenium+python自动化unittest之跳过用例skip
2024-09-04 15:37:09
前言
当测试用例写完后,有些模块有改动时候,会影响到部分用例的执行,这个时候我们希望暂时跳过这些用例。
或者前面某个功能运行失败了,后面的几个用例是依赖于这个功能的用例,如果第一步就失败了,后面的用例也就没必要去执行了,直接跳过就行,节省用例执行时间。
一、skip装饰器
skip装饰器一共有四个
@
unittest.
skip
(reason)
Unconditionally skip the decorated test. reason should describe why the test is being skipped.
翻译:无条件跳过用例,reason是说明原因
@
unittest.
skipIf
(condition, reason)Skip the decorated test if condition is true.
翻译:condition为true的时候跳过
@
unittest.
skipUnless
(condition, reason)Skip the decorated test unless condition is true.
翻译:condition为False的时候跳过
@
unittest.
expectedFailure
Mark the test as an expected failure. If the test fails when run, the test is not counted as a failure.
翻译:断言的时候跳过(暂时不知道有啥用,没看懂,貌似断言失败,也变成用例pass了。)
最新文章
- 深入理解DOM节点类型第五篇——元素节点Element
- 前端学PHP之文件操作
- C# RFID windows 服务 网络协议方式
- jeasyui datagrid控件的一个小问题
- Python 字符串操作
- Webpack打包进阶
- ServiceLocator 简单示例(转)
- 图说苹果工作站-MAC PRO
- 一个利用sed和awk处理文本的小栗子
- ueditor:原谅我这一生不羁放纵爱独特
- iOS 知识-常用小技巧大杂烩
- linux tar包追加问题【转】
- 【js实例】js中的5种基本数据类型和9种操作符
- dubbox系列【一】——dubbox简介
- 自相关系数 ACF与偏自相关系数PACF,拖尾和截尾
- python-初识python
- docker报Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.19)
- MySQL保留字 ERROR 1064 (42000)
- js 一键复制
- 「FJOI2016」神秘数 解题报告
热门文章
- Python实现跨文件全局变量的方法
- python3中urllib的基本使用
- coderfoces446c (斐波那契数列)
- Python.h:No such file or directory
- ubuntu12.04向左边栏添加图标(引用)
- Ruby module里的self
- HDU-ACM“菜鸟先飞”冬训系列赛——第9场
- bzoj 4849: [Neerc2016]Mole Tunnels【模拟费用流】
- bzoj 2194: 快速傅立叶之二【NTT】
- zoj 2587 Unique Attack【最小割】