EMMA问题汇总

1. 没有生成coverage.emma?

这个原因主要是因为在运行代码的时候,没有使用emma instr生成的class来运行,而只是使用javac编译的class来运行。正确的做法是先使用<instr>注入要运行的class,然后把这个class放到运行代码的class path中,如junit

 

2. no sources will be embedded in the report

这个问题曾经困扰了比较长的时间,就是生成的coverage上不能链接到对应的java源文件,后来在emma官方网站找到如下解释:

3.8. Why does <report>/report generate weird warnings like "not all instrumented classes were compiled with source file debug data" or "not all instrumented classes were compiled with line number debug data"?

^

Because you have not compiled all your classes with full debug data, EMMA is "gracefully" degrading to not doing any source linking and not generating any line coverage data.

Depending on your original intentions, you have several options:

  • If you want line coverage and source code linking, recompile and reinstrument with full debug data. If you are compiling in several steps, you might be forgetting the -g (debug='true' in ANT) flag in just one of the steps -- in this case, EMMA's trace ("showing up to 3 classes without full debug info per package...") should help identify which packages were compiled improperly. (Also, see this if the problem persists.)

  • You do want line coverage and source code linking, but a 3rd party lib (not debug-compiled) is messing things up. The right thing to do is to exclude that lib from EMMA's instrumentation in the first place.

  • You are using EMMA on someone else's compiled classes (no sources) or you only want basic block coverage. The right thing to do is to remove the line coverage column from the report and ignore all remaining warnings.

 

简单来说,就是在编译生成class文件时,使用dubeg=”true”即可

转载于:https://www.cnblogs.com/lettoo/archive/2010/12/06/1897915.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值