Le vendredi 21 mars 2014 10:27:39 UTC+1, Bhupendra Mahajan a écrit : > 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 > Download the Jacoco package http://www.eclemma.org/jacoco/ > Extract the jar to some folder in your local machine viz. <JACOCO_HOME>Create > folder <Path_TO_JACOCO>/reportsCreate folder > <Path_TO_JACOCO>/reports/jacococlassesIn karaf.bat put following > set JACOCO_HOME=<Path_TO_JACOCO>/Jacocoset 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 > Start karafExecute the tests that you want to perform on AUTShutdown the > karaf elegantly (I use Ctrl + D)See that jacoco.exec is now populated and > <JACOCO_HOME>/reports/jacococlasses > Download eclipse (I used Kepler)Install maven pluginCreate a project > jacoco-maven-pluginCreate a POM file with content given belowRun maven > project (RClick on project -> Run As -> Maven Clean)Run maven project (RClick > on project -> Run As -> Maven Install) > Now copy the classes (com folder) from <JACOCO_HOME>/reports/jacococlasses to > <eclipse_project_root>/target/classesCopy jacoco.exec from > <JACOCO_HOME>/reports/ to <eclipse_project_root>/targetNow from eclipse run > the plugin (RClick on project -> Run As -> Run Configurations)In goals put > "org.jacoco:jacoco-maven-plugin:report"Click on RunOn successful run a new > folder <eclipse_project_root>/site/jacoco will be createdThe 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>
Hi, It works too with Pax-exam, jacoco-maven and failsafe, without having to tweak karaf instance: You just have to pass the jacoco.argline as a failsafe systemVariable, then register a paxExam vmOption corresponding to the variable previously registered. See here for the Exam vm Option: https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.framework/net.osgiliath.features.karaf-features/net.osgiliath.features.karaf-features.itests/net.osgiliath.features.karaf-features.itests.cdi/src/it/java/helper/exam/AbstractKarafPaxExamConfiguration.java And here for the plugins configuration (look at failsafe and jacoco): https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.poms/net.osgiliath.pom.repositories/net.osgiliath.pom.reporting/net.osgiliath.pom.plugins/pom.xml Regards, -- 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.
