Eclipse + Pydev如何获得单元测试覆盖率? [英] How to get unit test coverage results in Eclipse + Pydev?

查看:231
本文介绍了Eclipse + Pydev如何获得单元测试覆盖率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Eclipse + PyDev有一个选项 Run As => 3 Python Coverage 。但是所有报告都是:


在0.001s中进行6次测试



确定


它没有说明代码覆盖。如何在Pydev中获取代码覆盖率报告?

解决方案


  • 运行Python Coverage

  • 窗口>显示视图>代码覆盖结果视图

  • 选择执行文件的目录

  • 双击文件列表中执行的文件

  • 统计信息现在在右边,代码视图中未执行的行被标记为红色



    • 其实这是一个非常好的功能,以前不了解它:)


      I know Eclipse + PyDev has an option Run As => 3 Python Coverage. But all it reports is:

      Ran 6 tests in 0.001s

      OK

      And it says nothing about code coverage. How to get a code coverage report in Pydev?

      解决方案

      • Run a file with "Python Coverage"
      • Window > Show View > Code Coverage Results View
      • Select the directory in which the executed file is
      • Double-click on the executed file in the file list
      • Statistics are now at the right, not executed lines are marked red in the code view

      Actually this is a really nice feature, didn't know about it before :)

      这篇关于Eclipse + Pydev如何获得单元测试覆盖率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆