前言

当测试用例写完后,有些模块有改动时候,会影响到部分用例的执行,这个时候我们希望暂时跳过这些用例。

或者前面某个功能运行失败了,后面的几个用例是依赖于这个功能的用例,如果第一步就失败了,后面的用例也就没必要去执行了,直接跳过就行,节省用例执行时间。

一、skip装饰器

skip装饰器一共有四个

   @unittest.skip(reason)

  • Unconditionally skip the decorated test. reason should describe why the test is being skipped.

    翻译:无条件跳过用例,reason是说明原因

  • @unittest.skipIf(conditionreason)

  • Skip the decorated test if condition is true.

    翻译:condition为true的时候跳过

  • @unittest.skipUnless(conditionreason)

  • 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了。)

最新文章

  1. 深入理解DOM节点类型第五篇——元素节点Element
  2. 前端学PHP之文件操作
  3. C# RFID windows 服务 网络协议方式
  4. jeasyui datagrid控件的一个小问题
  5. Python 字符串操作
  6. Webpack打包进阶
  7. ServiceLocator 简单示例(转)
  8. 图说苹果工作站-MAC PRO
  9. 一个利用sed和awk处理文本的小栗子
  10. ueditor:原谅我这一生不羁放纵爱独特
  11. iOS 知识-常用小技巧大杂烩
  12. linux tar包追加问题【转】
  13. 【js实例】js中的5种基本数据类型和9种操作符
  14. dubbox系列【一】——dubbox简介
  15. 自相关系数 ACF与偏自相关系数PACF,拖尾和截尾
  16. python-初识python
  17. docker报Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.19)
  18. MySQL保留字 ERROR 1064 (42000)
  19. js 一键复制
  20. 「FJOI2016」神秘数 解题报告

热门文章

  1. Python实现跨文件全局变量的方法
  2. python3中urllib的基本使用
  3. coderfoces446c (斐波那契数列)
  4. Python.h:No such file or directory
  5. ubuntu12.04向左边栏添加图标(引用)
  6. Ruby module里的self
  7. HDU-ACM“菜鸟先飞”冬训系列赛——第9场
  8. bzoj 4849: [Neerc2016]Mole Tunnels【模拟费用流】
  9. bzoj 2194: 快速傅立叶之二【NTT】
  10. zoj 2587 Unique Attack【最小割】