今天在用使用emma的过程中遇到了几个问题,记录一下.

1.跑junit过程中没办法产生coverage data文件,导致最后没办法出emma报告,上官网查了一下原因如下:

I have instrumented my classes but am not getting any coverage data…
This question has been asked several times and in all cases the users forgot to package or deploy the instrumented versions of their classes. Please check that your build places EMMA-instrumented classes ahead of the normal application classpath at runtime.

意思是emma会根据工程里面的class文件产生自己的instrumented class,junit在跑单元测试的时候,classpath要把定义emma的class文件路径放在项目class文件路径前面,才能产生coverage data文件。

1
2
3
4
5
<junit ...>
<classpath location="${emma.classes.dir}"/>
<classpath location="${project.classes.dir}"/>
...
</junit>

2.emma的示例代码里面,report的sourcepath属性只有一个src路径,如果项目里面有多个src路径同时要进行覆盖率检查的话,则需要这样写:

1
2
3
<report sourcepath="${src1};${src2};${src3}">
...
</report>

不同的src路径用操作系统的classpath分隔符或逗号隔开,比如window用分号隔开,官网是这样解释的:

sourcepath : An optional source path to use for report generation (a path-like structure). It is interpreted as a list of directories (separated by the OS-specific classpath separator or comma) containing .java source files. The local path names within each directory should reflect class package names. (Currently, only the HTML report generator uses this data, and only atmethod report depth.)

3.jenkins的emma插件可以显示覆盖率的趋势,已经包,类,方法的覆盖率情况,但不支持链接显示代码源文件,看了下jenkins的官网,有人已经对插件提了这样一个需求,但回复说无法实现,说明如下:

This was an obvious feature and so I tried to do this, but the problem is that the HTML file names and anchors that EMMA puts are just random numbers. So Hudson cannot link to the appropriate portion of those HTML files.

I also thought about generating those reports by myself in Hudson, but EMMA doesn’t leave the line-by-line coverage information in XML file either.

So that leaves me no choice but to parse emma’s data file directly. So this is bit involving.  

意思是说emma的html源文件是用随机数字命名,所以在xml文件中无法链接这些html源文件,emma没有修复这个问题,插件作者也无法完成这个需求:(

我的解决方案是用doc link插件在jenkins页面上直接链接coverage.html文件。

使用emma时遇到的一些问题的更多相关文章

  1. windows类书的学习心得(转载)

    原文网址:http://www.blogjava.net/sound/archive/2008/08/21/40499.html 现在的计算机图书发展的可真快,很久没去书店,昨日去了一下,真是感叹万千 ...

  2. 从 Paxos 到 ZooKeeper

    分布式一致性 分布式文件系统.缓存系统和数据库等大型分布式存储系统中,分布式一致性都是一个重要的问题. 什么是分布式一致性?分布式一致性分为哪些类型?分布式系统达到一致性后将会是一个什么样的状态? 如 ...

  3. 代码覆盖率工具 EMMA

    使用 EMMA 获得功能测试覆盖率 测试覆盖率是评价测试完整性的重要的度量标准之一. EMMA 是一个面向 Java 代码的测试覆盖率收集工具.在测试过程中,使用 EMMA 能使收集和报告测试覆盖率的 ...

  4. ubutu之mysql emma中文乱码问题解决

    emma默认用apt-get 安装的话,emma是不支持中文的,配置文件或直接修改emma程序源文件(python).apt-get安装emmasudo apt-get install emma    ...

  5. EMMA 覆盖率工具

    1. EMMA 介绍 EMMA 是一个开源.面向 Java 程序测试覆盖率收集和报告工具.它通过对编译后的 Java 字节码文件进行插装,在测试执行过程中收集覆盖率信息,并通过支持多种报表格式对覆盖率 ...

  6. 测试覆盖率Emma工具使用

    Emma使用与分析 #什么是Emma EMMA 是一个开源.面向 Java 程序测试覆盖率收集和报告工具.它通过对编译后的 Java 字节码文件进行插装,在测试执行过程中收集覆盖率信息,并通过支持多种 ...

  7. emma中文显示乱码问题解决

    在Linux中如果使用mysql的图形客户端,个人感觉Emma还不错.但是emma默认用apt-get 安装的话,emma是不支持中文的,这个需要自己修改一下了配置文件,或者直接修改emma程序源文件 ...

  8. 故障重现, JAVA进程内存不够时突然挂掉模拟

    背景,服务器上的一个JAVA服务进程突然挂掉,查看产生了崩溃日志,如下: # Set larger code cache with -XX:ReservedCodeCacheSize= # This ...

  9. XStream将java对象转换为xml时,对象字段中的下划线“_”,转换后变成了两个的解决办法

            在前几天的一个项目中,由于数据库字段的命名原因 其中有两项:一项叫做"市场价格"一项叫做"商店价格" 为了便于区分,遂分别将其命名为market ...

随机推荐

  1. JDBC中 execute 与 executeUpdate的区别

    相同点 execute与executeUpdate的相同点:都可以执行增加,删除,修改 不同点 execute可以执行查询语句 然后通过getResultSet,把结果集取出来 executeUpda ...

  2. The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决方法

    项目忽然出现 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Pat ...

  3. 【TCP/IP详解 卷一:协议】第二十三章 TCP的保活定时器

    本章介绍保活定时器. 在 TCP 的三握四挥 章节中,我们介绍了 处在 TIME_WAIT 的 2MSL定时器:在 TCP的超时与重传 章节中,我们介绍了 重传定时器:在上一章节中,我们介绍了 防止死 ...

  4. JS post 数组道后台

    $("#aSave").click(function () { if ($("#TaskName").val() == "") { aler ...

  5. 使用docker安装myql/redis等软件

    使用docker安装myql/redis等软件 概述 基本命令 安装mysql 安装redis 概述 在开发时经常需要安装各种软件,有时甚至为了验证一个命令不得不安装配置一个缓存.数据库.MQ等,耽误 ...

  6. HTML元素1: 基本元素,标题,段落,链接,图像等

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. BeyondCompare

    BeyondCompare可对文本,照片,文件夹,注册表等等进行比较 在git看不清楚版本和改动项的时候,直接将生产上的包拉下来和即将发布的包,作对比.

  8. [源][osg][osgBullet]osgBullet例子介绍

    1.BasicDemo 基本样例 一个小玩具飞机坠落,一个立方体盒子在转圈 2.centerofmass 质心 3.collision 碰撞检测 这里有一个大神自己改的例子: http://blog. ...

  9. java数组声明和变式--record1

    ​ java声明数组方式: String[] namelist; int numlist[];//此声明为动态声明,不能指定长度,numlist[10] 静态声明的方式: int a[]={1,2,3 ...

  10. RabbitMQ入门_12_发布方确认

    参考资料:https://www.rabbitmq.com/confirms.html 通过 ack 机制,我们可以确保队列中的消息一定能被消费到.那我们有办法保证消息发布方一定把消息发送到队列了吗? ...