如何开始“写作”代码覆盖工具? [英] How to get started "writing" a code coverage tool?

查看:126
本文介绍了如何开始“写作”代码覆盖工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找实际讨论如何的书籍或其他参考资料,在Java中编写代码覆盖工具;一些各种技术或技巧 - 源码与字节码仪表。

Looking for books or other references that discuss actually "how" to write a code coverage tool in Java; some of the various techniques or tricks - source vs. byte code instrumentation. This is for a scripting language that generates java byte code under the hood.

推荐答案

脚本语言字节码是否生成?它生成调试元数据吗?如果是这样,字节码仪器可能是去的方式。事实上现有的工具可能会工作;也许是最小的修改(典型的问题是工具被编写为使用Java和假设com.foo.Bar.class对应于com / foo / Bar.java。解开这个假设可以是乏味的。) EMMA 是一个ClassLoader,为Java中的代码覆盖收集执行字节码重写。

Is your scripting language bytecode generating? Does it generate debug metadata? If so, bytecode instrumentation is probably the way to go. In fact existing tools like will probably work; perhaps with minimal modification (the typical problem is the tools are written to work with Java and assume com.foo.Bar.class corresponds to com/foo/Bar.java. Unwinding that assumption can be tedious.) EMMA is a ClassLoader that does byte-code re-writing for code-coverage collection in Java. The coding style is a little funky, but I recommend reading the source for some ideas.

如果你的脚本语言被解释,你将需要一些更高级别(源级别)挂钩到解释器中。

If your scripting language is interpreted then you will need something higher-level (source level) that hooks into the interpreter.

这篇关于如何开始“写作”代码覆盖工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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