问题描述
我已切换到最新的JDK 7,并且在以emma覆盖工具为伪装的字节码上运行testng单元测试时遇到问题.我的所有测试用例都无法正常运行,对于大多数测试用例,我都收到此类错误.
I have switched to the newest JDK 7 and I am having problems with running testng unit test on byte code that is fiddled by emma coverage tool. None of my test cases are run correctly and for most of them I am receiving such errors.
java.lang.ClassFormatError: Illegal local variable table length 10 in method measurement.meter.AbstractSerialPortMeter.<init>(Lmeasurement/meter/SerialPort;)V at measurement.meter.Elc3133aTest.setUp(Elc3133aTest.java:42)
我在这里 JSR 292优良性快速代码覆盖率工具少10k ,这就是说:"JSR 292引入了新的字节码指令invokedynamic,还引入了几种新的常量池常量.这意味着解析字节码的大多数工具(例如ASM,BCEL,findbugs或EMMA)都需要更新为Java 7兼容."
I have found an article here JSR 292 Goodness Fast Code Coverage Tool Less 10k,which is saying that "JSR 292 introduces a new bytecode instruction invokedynamic but also several new kind of constant pool constants. Which means that most of the tools that parse bytecodes like ASM, BCEL, findbugs or EMMA will need to be updated to be java 7 compatible."
检查了Emma主页,但似乎很长一段时间没有更新了.
Checked Emma homepage, but it looks like it has not been updated for a long long time.
有人解决过类似的问题吗?
Has anybody solved a similar problem?
我也尝试过Cobertura.看起来效果更好一些,但是我遇到了很多VerifyError
类型的异常.
I have also tried with Cobertura. It looks to work a bit better but I am getting a lot of exceptions of type VerifyError
.
java.lang.VerifyError: Expecting a stackmap frame at branch target 85 in method measurement.meter.AbstractSerialPortMeter.close()V at offset 26
at measurement.meter.AbstractSerialPortMeterTest.setUp(AbstractSerialPortMeterTest.java:27)
推荐答案
我遇到了同样的问题.幸运的是,beta版可与JDK 7一起使用.
更新站点链接: http://download.eclipselab.org/eclemma/beta/2.0.0/update/
此链接应在Eclipse中使用:
I had the same issue.Fortunately beta works with JDK 7.
Update site link: http://download.eclipselab.org/eclemma/beta/2.0.0/update/
This link should be used in Eclipse:
Help -> Install new software... -> Add...
休息应该很容易;)
Rest should be easy ;)
这篇关于Testng,Emma,Cobertura,coverage和JDK 7导致ClassFormatError和VerifyError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!