Emma code coverage report

I have a maven project that follows the general networking package.

I want to run Emma tool for code coverage. Requirement: I want to run emma code coverage tool for my maven based project and generate a report.

I am completely new to this tool and am testing the commands listed on the internet. Since I don't have any main method in my maven project (we get ear and deploy to jboss), I had to create a pojo file to call the service and build a pojo jar by including the maven project jars.

Now I only have emma.jar on my system, a jar containing the main method and java project. As I want in a report based format from the tool, I run the emma tool from the command line (in the place where emma.jar is present) ->java emmarun -jar <jar containing the main method>

I get the report as

[EMMA v2.0.5312 report, generated Thu Mar 29 20:36:04 IST 2012]
OVERALL COVERAGE SUMMARY:

[class, %]  [method, %] [block, %]  [line, %]   [name] 
100% (5/5)  79%  (11/14)    77%  (266/344)! 76%  (60/79)!   all classes

OVERALL STATS SUMMARY:

total packages: 1 total classes:    5 total methods:    14 total executable files:  4 total executable lines:   79

COVERAGE BREAKDOWN BY PACKAGE:

[class, %]    [method, %]      [block, %]      [line, %]    [name] 100% (5/5)
79%  (11/14)  77%  (266/344)!  76%  (60/79)!   org.eclipse.jdt.internal.jarinjarloader
-------------------------------------------------------------------------------

      

But from here I don't understand which class files are being considered during a method call from the pojo file linked in the jar.

I'm not sure about my approach or is there no other step I am missing to get the report?


Are there any ref references for unit tests. Can I code a simple unit test ... the usage steps were pretty confusing. So I want to say that any simple step to test a maven project using the command line for code coverage ... else is there any other tool other than emma that can simplify my approach ... I want to use some code coverage tool for checking maven project from command line .. this is my main requirement

+3


source to share


3 answers


Read this QuickStartGuide .

You must provide the source code and generate an html report to view the complete statistics.



Example:

java -cp emma.jar emmarun -r html -jar the_jar -sp path_to_source

      

0


source


Since you are using Maven anyway, you should also use it to generate Emma reports:



mvn emma:emma

      

+2


source


Instead of using it -jar

might help -cp

.

java -cp emma.jar emmarun -cp Test.jar MainClassName

      

0


source







All Articles