How does Emma work?
For using Emma we'll first instrument the jar using Emma. During that time em metadata files will get generated and when you run the JUnit test cases over the instrumented jars ec files will get generated. Which is used for generating the coverage report.
My quest开发者_如何学Goion is we are not specifying the path to the em files when we are running the the test cases, so how it is able to generate the ec files? also I have heard Emma uses a port while running. What is that port ?
Andrew, by default EMMA is using current folder to look for coverage.em file. I don't believe it is listening on any TCP ports, I did a quick scan trough EMMA source code and couldn't find any references to sockets. It is only using URLs for loading class files from the classpath for instrumentation.
Emma uses a feature called bytecode manipulation during its instrumentation phase. If you open up the instrumented class files in a decompiler, you'll notice that it would've introduced several additional lines of code.
It is this additional code that does the reporting. It will be something as simple as a simple log indicating that the code at that particular line number has executed.
When you generate the reports, emma uses the ec
file to generate a human readable format of the report.
精彩评论