{"id":338,"date":"2013-05-17T11:54:07","date_gmt":"2013-05-17T11:54:07","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2013\/05\/17\/overview-of-emma\/"},"modified":"2017-12-25T01:12:53","modified_gmt":"2017-12-25T01:12:53","slug":"overview-of-emma","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/overview-of-emma\/","title":{"rendered":"Overview of EMMA | Code Coverage Tool &#8211; EMMA"},"content":{"rendered":"<h1><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3763 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2013\/05\/emma-overview.png\" alt=\"emma-overview\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2013\/05\/emma-overview.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2013\/05\/emma-overview-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Overview<\/h1>\n<p>EMMA is a tool for measuring <em>coverage<\/em> of Java software. Such a tool is essential for detecting dead code and verifying which parts of your application are actually exercised by your test suite and interactive use.<br \/>\nEMMA&#8217;s design strives for several, very elusive in their combination, goals:<\/p>\n<ul>\n<li>report rich coverage analysis data without introducing significant overhead during <em>either<\/em> build <em>or<\/em> execution time<\/li>\n<li>be useful in team development environments, while at the same time enabling fast individual develop-test cycle<\/li>\n<li>support quick development and testing of small standalone Java applications as well as scale up to massive enterprise sotfware suites containing thousands of Java classes<\/li>\n<\/ul>\n<p><strong>Advantages of Emma over other coverage tools<\/strong><\/p>\n<p>EMMA differs from other coverage tools in its extreme orientation towards <em>fast<\/em> iterative develop-test style of writing software. JVM Profiler Interface (JVMPI)-based tools do not require an instrumented source build, but the runtime overhead of running with JVMPI on is empirically known to be very high and results in depressingly slow testsuite runs. For tools based on source code instrumentation, having to wait for a full source code rebuild just to check coverage metrics is not something a normal developer wants to do several times during a day. EMMA&#8217;s goal is to be so <em>unintrusive<\/em> that frequent daily checking of coverage numbers becomes second nature to <em>every<\/em> developer on the team, if not a completely automatic byproduct of every test run.<\/p>\n<p><strong>Install and Configuration<\/strong><\/p>\n<p>Method 1: To run on Command Line.<br \/>\nCopying emma.jar to &lt;your\u00a0jre\u00a0dir&gt;\/lib\/ext\/ directory for whichever JRE you use from command line.<br \/>\nMethod 2:<br \/>\nStill, if you are wary of adding a third-party library as a standard JRE extension, just make sure that all your EMMA command line invocations add emma.jar to the JVM classpath:<br \/>\n&gt;java -cp &#8230;\/lib\/emma.jar &lt;emma or emmarun command&gt;<\/p>\n<p><strong>Implementing EMMA with Application<\/strong><\/p>\n<ul>\n<li>On the Fly Mode \u2013 Based suited for Standalone Application<\/li>\n<li>Offline Mode \u2013 Best suited for J2EE framework based application<\/li>\n<\/ul>\n<p><strong>Implement EMMA in J2EE project {WebLogic, Websphere, Tomcat, JBoss, &#8230;}?<\/strong><\/p>\n<p>There are very less opportunities given by Emma that\u00a0 you would be able setup emma for J2EE Project on the fly mode. The reason behind this to fact that many J2EE features requires specialized class loading that will happen outside EMMA instrumenting class holder. The server might run fine but you will unlikely to get EMMA report.<br \/>\nSo, based Procedures to Instrument your classes prior to deployment (offline mode); offline instrumentation always follows the same compile \/ instrument \/ Package \/ deploy \/ get coverage \/ Generate report sequence.<br \/>\nThere are following steps need to follow to implement EMMA in J2EE based project\u2026<\/p>\n<ul>\n<li>Use EMMA\u2019s instr tool to instrument the desire classes. This can be done a post compilation step, before packaging. However many users also find it convenient to let EMMA process their jars directly (either in place, using overwrite mode, or by creating separate instrumented copies of everything, fullcopy mode.<\/li>\n<li>do your J2EE packaging as normal, but do <em>not<\/em> include <strong>emma.jar<\/strong> as a lib at this level, that is, within your .war, .ear, etc;<\/li>\n<li>locate whichever JRE is used by the container and copy <strong>emma.jar<\/strong> into its &lt;jre\u00a0dir&gt;\/lib\/ext directory. If that is impossible, add <strong>emma.jar<\/strong> to the server classpath (in a server-specific way);<\/li>\n<li>deploy your instrumented classes, .jars, .wars, .ears, etc and exercise\/test your J2EE application via your client-side testcases or interactively or whichever way you do it;<\/li>\n<li>to get a coverage dump file, you have three options described. It is highly recommended that you use coverage.get\u00a0 control command with the ctl tool available in v2.1.<\/li>\n<\/ul>\n<p><strong>Notes:<\/strong><\/p>\n<p>Reference:<br \/>\n<a href=\"http:\/\/emma.sourceforge.net\/faq.html#q.runtime.appservers\" target=\"_blank\" rel=\"noopener\">http:\/\/emma.sourceforge.net\/faq.html#q.runtime.appservers<\/a><br \/>\n<a href=\"http:\/\/emma.sourceforge.net\/reference\/ch02s03.html#tool-ref.instr.outmodes\" target=\"_blank\" rel=\"noopener\">http:\/\/emma.sourceforge.net\/reference\/ch02s03.html#tool-ref.instr.outmodes<\/a><\/p>\n<p>Emma Integration with other tools<\/p>\n<p>Emma Integration with Sonar<br \/>\nEmma Integration with Hudson<br \/>\nEmma Integration with CruiseControl<\/p>\n<p><strong>jar instrumentation using Emma<\/strong><\/p>\n<p><a href=\"http:\/\/primates.ximian.com\/~flucifredi\/emma-HOWTO.html\" target=\"_blank\" rel=\"noopener\">http:\/\/primates.ximian.com\/~flucifredi\/emma-HOWTO.html<\/a><br \/>\n<a href=\"http:\/\/emma.sourceforge.net\/reference\/ch02s03.html#tool-ref.instr.outmodes\" target=\"_blank\" rel=\"noopener\">http:\/\/emma.sourceforge.net\/reference\/ch02s03.html#tool-ref.instr.outmodes<\/a><br \/>\n<a href=\"http:\/\/primates.ximian.com\/~flucifredi\/emma-HOWTO.html\" target=\"_blank\" rel=\"noopener\">http:\/\/primates.ximian.com\/~flucifredi\/emma-HOWTO.html<\/a><br \/>\n<a href=\"http:\/\/groovy.329449.n5.nabble.com\/EMMA-Code-Coverage-has-problem-with-Groovy-classes-td360560.html\" target=\"_blank\" rel=\"noopener\">http:\/\/groovy.329449.n5.nabble.com\/EMMA-Code-Coverage-has-problem-with-Groovy-classes-td360560.html<\/a><\/p>\n<h1><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>Overview EMMA is a tool for measuring coverage of Java software. Such a tool is essential for detecting dead code and verifying which parts of your application are actually exercised by your test suite and interactive use. EMMA&#8217;s design strives for several, very elusive in their combination, goals: report rich coverage analysis data without introducing&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3763,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[62],"tags":[2337,1003,784,610,2334,1040,2331,514,2335,2336,341],"class_list":["post-338","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-analysis","tag-advantages-of-emma","tag-code","tag-code-analysis","tag-code-coverage","tag-code-coverage-tool","tag-coverage","tag-coverage-tools","tag-emma","tag-emma-overview","tag-overview-of-emma","tag-tool"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":3764,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/338\/revisions\/3764"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3763"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}