`
yutiansky
  • 浏览: 193100 次
  • 性别: Icon_minigender_1
  • 来自: 本溪
社区版块
存档分类
最新评论

Cobertura 笔记

阅读更多

1,从 http://cobertura.sourceforge.net/ 下载

2,相关 ant 文件

<project name="MyProject" default="instrument" basedir=".">

	<property name="cobertura.dir" value="cobertura" />

	<path id="cobertura.classpath">
	    <fileset dir="${cobertura.dir}">
	        <include name="cobertura.jar" />
	        <include name="lib/**/*.jar" />
	    </fileset>
	</path>

	<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />

	<target name="instrument">
		<cobertura-instrument todir="build/instrumented-classes">
		    <fileset dir="build/classes">
		        <include name="**/*.class"/>
		    </fileset>
		</cobertura-instrument>
	</target>

	<target name="report">
	    <cobertura-report srcdir="src/java" destdir="build/coverage" encoding="UTF-8" />
	</target>

</project>

3, 将生成的 cobertura.ser 放在 tomcat 根目录下。

4, 将相关 jar 放在 lib 下。

5, 将加工后的 class 放到 classes 下。

6, 运行 tomcat 。

7, 测试。

8, 停止 tomcat。

9, 用 tomcat 根目录下的 cobertura.ser 就能得到覆盖率报告了。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics