一、需求痛点

  1、HTMLreport没法看到log日志,经过封装的框架不可能走一步就print()

  2、 希望可以在HTMLreport中输出log日志

  3、痛点截图

  web自动化 -- HTMLreport(三)测试报告输出log日志

 

 

二、解决办法

  1、既然是HTMLreport的输出问题,自然是修改HTMLreport的内容了。

  2、思路

    1)先查看HTMLreport的使用方法,寻找突破口

    web自动化 -- HTMLreport(三)测试报告输出log日志

     2)由上图得知,我们可以在实例化HTMLTestrunner的时候,可以直接给它传入一个logger进去,不就可以输出自己想要的log日志了嘛

 

  2、修改HTMLreport的具体的点

    1)先改HTMLTestrunner类 以及 HTMLTestrunner类下的 run() 方法

     web自动化 -- HTMLreport(三)测试报告输出log日志

    2)再修改专门写结果的 _TestResult  类

    web自动化 -- HTMLreport(三)测试报告输出log日志

    web自动化 -- HTMLreport(三)测试报告输出log日志

     web自动化 -- HTMLreport(三)测试报告输出log日志

 

     web自动化 -- HTMLreport(三)测试报告输出log日志

 

  3、使用方法

  web自动化 -- HTMLreport(三)测试报告输出log日志

 

 

三、效果

  web自动化 -- HTMLreport(三)测试报告输出log日志

  web自动化 -- HTMLreport(三)测试报告输出log日志

    web自动化 -- HTMLreport(三)测试报告输出log日志

    web自动化 -- HTMLreport(三)测试报告输出log日志

 

 

四、HTMLreportCN.py 的全部代码

   发留言或者私信,我直接私信发出。

 

相关文章:

  • 2021-11-30
  • 2021-12-21
  • 2021-07-18
  • 2021-07-18
  • 2021-10-19
  • 2021-05-24
猜你喜欢
  • 2021-06-13
  • 2021-04-19
  • 2021-11-30
  • 2022-12-23
  • 2021-11-30
  • 2021-11-30
  • 2021-12-26
相关资源
相似解决方案