Static info about your Java classes, methods, lines, and basic blocks and

Yüklə 10.02 Kb.
ölçüsü10.02 Kb.

metadata (static info about your Java classes, methods, lines, and basic blocks) and runtime

coverage data (which basic blocks have been executed). These are stored in files with *.em and

*.ec extensions, respectively.

Note that you can mix and match as many files of both types to generate a coverage report as

you want. For example, you can get one *.ec file on a client machine and another *.ec file on

entirely different server machine, and later combine both.

We can use unit tests on EMMA, of course, but it seems to me that there is some limit for it on

especially Offline mode. The advantage of Offline mode is that we can put our data into a

report. When using unit tests on Offline mode, It can't be allowed to do so fully. I mean that we

can get a text report in the way to compile and get necessary data for the mode, but you know,

we need “*.ec” and “.em” to complete the mode. And also we need a main class to do so, since

there is no main in unit tests, it's not possible in my experiments.
On-The-Fly mode

javac -cp /Users/kawashimakawashima4/Desktop/junit/junit.jar:.

java -cp



-cp /Users/kawashimakawashima/junit/junit.jar:. Junit.textui.TestRunner TargetTest

If you want to get other type of reports rather than txt,

-r html, xml after emmarun and before TargetTest

When you choose the report type, html, should specify -sourcepath

-sourcepath,sp where the targetTest is

Then get a report for it. It includes the information about the test class, and junit class and the

target class for the test.

Offline mode

mkdir out

javac -d out -g

mkdir outinstr

java emma instr -d outinstr -ip out

then, get “coverage.em” by default

java -cp outinstr:out targetMainClassName

then, get “” by default
It's time to get unit test for it on Offline mode

javac -cp /Users/kawashimakawashima4/Desktop/junit/junit.jar:.

java emma run -cp


/junit/junit.jar : . junit.textui.TestRunenr TargetTest

then if try to get “*.em” and “*.ec”, get an error. And that getting them means that you have instrumented the unit test. What we want to do is to use a class that has been instrumented with the unit test. So it makes sense that it not possible to merge unit test information and others.

<Information about the debug information for EMMA>

If you don't provide full debug data, you don't get the analysis with the source file.

This is for making clear which file is the original one and instrumented one. It is not necessary

to do so, because there is an overwrite mode on EMMA. But it makes sens to divide them into

different directories.

As a special case, when full debug info is available, class is equivalent to source.

Notice an important detail: the instrumented classes must appear first in the classpath. Also,

instr does not copy non-executable items like interfaces and resource bundles, so you need to

have the original out behind outinstr for everything to work.

Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur © 2016
rəhbərliyinə müraciət

    Ana səhifə