Hi All,

After struggling a lot I was able to generate the reports for my 
Application Under Test (AUT)

May be helpful to someone, so just listing down the steps that I followed

   1. Download the Jacoco package http://www.eclemma.org/jacoco/
   2. Extract the jar to some folder in your local machine 
   viz. <JACOCO_HOME>
   3. Create folder <Path_TO_JACOCO>/reports
   4. Create folder <Path_TO_JACOCO>/reports/jacococlasses
   5. In karaf.bat put following 
   1. *set JACOCO_HOME=<Path_TO_JACOCO>/Jacoco*
      2. set DEFAULT_JAVA_OPTS=-server -Xms%JAVA_MIN_MEM% 
      -Xmx%JAVA_MAX_MEM% -Dderby.system.home="%KARAF_DATA%\derby" 
      -Dderby.storage.fileSyncTransactionLog=true 
-Dcom.sun.management.jmxremote 
      
*-javaagent:%JACOCO_HOME%/lib/jacocoagent.jar=destfile=%JACOCO_HOME%/reports/jacoco.exec,append=true,includes=com.<yourCompany>.*,dumponexit=true,output=file,classdumpdir=%JACOCO_HOME%/reports/jacococlasses*
      6. Start karaf
   7. Execute the tests that you want to perform on AUT
   8. Shutdown the karaf elegantly (I use Ctrl + D)
   9. See that jacoco.exec is now populated 
   and <JACOCO_HOME>/reports/jacococlasses
   10. Download eclipse (I used Kepler)
   11. Install maven plugin
   12. Create a project jacoco-maven-plugin
   13. Create a POM file with content given below
   14. Run maven project (RClick on project -> Run As -> Maven Clean)
   15. Run maven project (RClick on project -> Run As -> Maven Install)
   16. Now copy the classes (*com *folder) from 
   <JACOCO_HOME>/reports/jacococlasses to <eclipse_project_root>/target/classes
   17. Copy jacoco.exec from <JACOCO_HOME>/reports/ to 
   <eclipse_project_root>/target
   18. Now from eclipse run the plugin (RClick on project -> Run As -> Run 
   Configurations)
   19. In goals put "org.jacoco:jacoco-maven-plugin:report"
   20. Click on Run
   21. On successful run a new folder <eclipse_project_root>/site/jacoco 
   will be created
   22. The code coverage report can be opened 
   from <eclipse_project_root>/site/jacoco/index.html

pom.xml >>>

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1</version>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.6.5.201403032054</version>
      </plugin>
    </plugins>
  </reporting>
</project> 

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to