Web page: English: http://www.cnblogs.com/morebetter/archive/2013/06/26/3156756.html
Http://www.ibm.com/developerworks/cn/opensource/os-cn-emma/index.html#download
English: http://emma.sourceforge.net/need to turn over the wall
EMMA Core plugin Emma.jar package, need to go to official website http://emma.sourceforge.net/download.
1 EMMA is an open source, Java-oriented program test coverage collection and reporting tool. It collects the coverage information during the test execution by inserting the compiled Java bytecode file, and displays the coverage results by supporting multiple report formats. Emma's use of bytecode inserts not only ensures that Emma does not bring "dirty code" to the source code, but also ensures that Emma is free of the source code, a feature that makes it possible for Emma to apply a functional test.
2 Before you use Emma to collect coverage information in your tests, you need to download the Emma.jar package from Emma's website. You can also get more resources about EMMA on this website.
3 EMMA can only collect the coverage of Java code.
4 Emma can also be used in combination with Ant, Maven, and so on. Need to download the appropriate plugin.
5 This article focuses on the combination of Emma and Maven, as it is often done with MAVEN management engineering.
Main references:
http://mojo.codehaus.org/emma-maven-plugin/
Http://mojo.codehaus.org/emma-maven-plugin/usage.html
Need to download two packages: Maven-emma-plugin-0.6.jar Emma-stable-2.1.5320-lib.zip.
After extracting the zip, copy the Maven-emma-plugin-0.6.jar and Emma.jar to the {Java_home}jre\lib\ext folder.
Add the following dependencies in the project's Pom file:
<build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid > <artifactId>maven-surefire-plugin</artifactId> <inherited>true</inherited > <configuration> <forkMode>once</forkMode> <reportformat>xml</ Reportformat> <classesdirectory>${project.build.directory}/generated-classes/emma/classes</ classesdirectory> </configuration> </plugin> </plugins> </build>
And
<reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-3</version> <inherited>true</inherited> </plugin> <plugin> <groupId> org.codehaus.mojo</groupid> <artifactId>surefire-report-maven-plugin</artifactId> <inherited>true</inherited> </plugin> </plugins> </reporting>
This is activated to produce the report, if not added will not be produced.
Also, pay attention to the position of the placement.
The links given above add Emma-maven-plugin to the plugins as well. Since we placed it directly under the JRE directory, we don't have to add it.
When you are finished adding, click Reimport in the top right of the pom file. After re-importing, run MVN Emma:emma in terminal.
This prompt writing [XML] report to ...
Under Target you can see the site and Surefire folder, which is the report generated. Open index.html to see very detailed coverage information. The page is as follows: Http://blog.chinaunix.net/uid-23741326-id-3716696.html is not mapped.
Emma-maven-plugin Statistics Java coverage plug-in