How to get started writing a code coverage tool?,
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.
Does your scripting language generate bytecode? Does it generate debug metadata? If so, bytecode instrumentation is probably the way to go. In fact existing tools will probably work (perhaps with minimal modification).
The typical problem with such tools that they are written to work with Java and assume that a
class com.foo.Bar.class corresponds to a file
com/foo/Bar.java. Unwinding that assumption can be tedious.
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 source code for some ideas.
If your scripting language is interpreted then you will need a higher-level class loader (at a source level) that hooks into the interpreter.
That’s the answer How to get started writing a code coverage tool?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.
The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you