为什么Cobertura在运行Eclipse插件时报告0%的覆盖率? [英] Why does Cobertura report 0% coverage when run through the Eclipse plugin?

查看:1357
本文介绍了为什么Cobertura在运行Eclipse插件时报告0%的覆盖率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(有一些这些问题,但是我可以找到的所有这些都与Maven有关,在你建议这个问题之前是一个重复的,请理解这与Maven无关。)

(There are a tonne of these questions, but all the ones I can find relate to Maven. Before you suggest this one is a duplicate, please understand that this doesn't relate to Maven in any way.)

我正在Eclipse中使用 Cobertura 来确定我的百分比的代码覆盖我的JUnit测试。 Cobertura内部和外部的所有99个单元测试都成功运行,但Cobertura报告说已经覆盖了我的代码的0%。

I am using Cobertura within Eclipse to determine my percentage of code covered by my JUnit tests. All 99 of my unit tests run successfully, both within and outside of Cobertura, but Cobertura reports back that they have covered 0% of my code.

I:


  • 通过Eclipse插件运行Cobertura

  • 使用Java 6,特别是Ubuntu上的OpenJDK-AMD64

  • 确保单元测试 do 覆盖我的代码的一些部分

  • 确保Cobertura正在运行我的所有测试文件夹在我所有的src文件夹中

  • 尝试清理和重建

  • am running Cobertura through the Eclipse plugin
  • am using Java 6, specifically OpenJDK-AMD64 on Ubuntu
  • have ensured that the unit tests do cover some sections of my code
  • have ensured that Cobertura is running all my test folder on all of my src folder
  • have tried to clean and rebuild

为什么Cobertura报告0%?

Why does Cobertura report 0%?

推荐答案

我发现这是一个问题,因为我正在编译没有行号的源文件。如果这是您的问题,您将看到

I found that this was a problem for me because I was compiling my source files without line numbers. If this is your problem, you will see

[cobertura-instrument] WARN visitEnd, No line number information found for class com.x.y.z.A.
Perhaps you need to compile with debug=true?

要解决这个问题,添加 debug =truedebuglevel =vars,线条,来源到您的 javac 命令。

To solve this, add debug="true" debuglevel="vars,lines,source" to your javac command.

另请参见:

http://meera-subbarao.blogspot.co.uk/2008/07/cobertura-instrument-warn-visitend-no.html

如何删除特定的Cobertura警告?

这篇关于为什么Cobertura在运行Eclipse插件时报告0%的覆盖率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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