Python Unittest框架用例执行失败自动截图

原生的unittest框架是不支持case失败后自动截图功能,网上的解决办法,大体上分为两种:

1、加装饰器

可参考unittest框架在fail时自动截图的装饰器给测试用例添加多个装饰器的问题 (python unittest.TestCase)

2、封装断言

可参考Getting Python's unittest results in a tearDown() methodpython 自动化测试,求助:如何判断用例断言失败后自动截图

猜你喜欢

转载自www.cnblogs.com/fanfeng/p/10740293.html
今日推荐