在执行测试用例时,有时候有些用例是不需要执行的,那我们怎么办呢?难道删除这些用例?那下次执行时如果又需要执行这些用例时,又把它补回来?这样操作就太麻烦了。

unittest提供了一些跳过指定用例的方法

  • @unittest.skip(reason):强制跳转。reason是跳转原因
  • @unittest.skipIf(condition, reason):condition为True的时候跳转
  • @unittest.skipUnless(condition, reason):condition为False的时候跳转
  • @unittest.expectedFailure:如果test失败了,这个test不计入失败的case数目

https://www.cnblogs.com/eastonliu/p/9145231.html

相关文章:

  • 2021-09-12
  • 2022-01-06
  • 2021-11-26
  • 2021-12-01
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-26
  • 2021-12-13
  • 2021-11-24
  • 2021-05-29
  • 2022-03-04
  • 2022-12-23
  • 2021-09-03
相关资源
相似解决方案