Is it possible to instrument a JAR file with emma and run testcases on the jar file to calculate the coverage? If there is any such way to do that please let me know.
Thanks
Cheers, Ali
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I don't use Ant or such too much so I could not help you there. That said, to instrument a jar file create a script something like the following:
java -cp {path_to_emma}/emma.jar emma instr -ip {path_to_my_jar_file}/myProgram.jar -out {path_to_results}/myProgram_coverage.em -merge no -m overwrite
After instrumentation your jar file will be at least twice as big. Then run the program using a script something like:
java -D{my Options} -Demma.coverage.out.file={path_to_results}myProgram_Coverage_file -cp {path_to_emma}/emma.jar :{path_to_myProgram}/myProgram.jar {name_of_main_class}
After you finish running your test(s) create an HTML report by:
java -cp {path_to_emma}/emma.jar emma report -in {path_to_results}/myProgram_coverage.em,{path_to_results}/myProgram_Coverage_file -r html -sp {path_to_source_code} -Dreport.sort=+name -Dreport.html.out.file={path_to_results}/myProgram.html
Read the manual for more detail. Good luck.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-10-28
I am using maven. I am also running into the same issue. I am unable to instrument the dependency jars. Could someone help us pls ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
Is it possible to instrument a JAR file with emma and run testcases on the jar file to calculate the coverage? If there is any such way to do that please let me know.
Thanks
Cheers, Ali
Ok, I don't use Ant or such too much so I could not help you there. That said, to instrument a jar file create a script something like the following:
java -cp {path_to_emma}/emma.jar emma instr -ip {path_to_my_jar_file}/myProgram.jar -out {path_to_results}/myProgram_coverage.em -merge no -m overwrite
After instrumentation your jar file will be at least twice as big. Then run the program using a script something like:
java -D{my Options} -Demma.coverage.out.file={path_to_results}myProgram_Coverage_file -cp {path_to_emma}/emma.jar :{path_to_myProgram}/myProgram.jar {name_of_main_class}
After you finish running your test(s) create an HTML report by:
java -cp {path_to_emma}/emma.jar emma report -in {path_to_results}/myProgram_coverage.em,{path_to_results}/myProgram_Coverage_file -r html -sp {path_to_source_code} -Dreport.sort=+name -Dreport.html.out.file={path_to_results}/myProgram.html
Read the manual for more detail. Good luck.
I am using maven. I am also running into the same issue. I am unable to instrument the dependency jars. Could someone help us pls ?