Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Emma Code Coverage Implementation Issue  RSS feed

Posts: 5
Hibernate Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Please raise the questions in stackoverflow and CodeRanch.

Dear All,

I am trying to get Code coverage using Junit and Emma. I have 5 java files for which i have written 4 Junit test cases.
Junits are running fine but the code coveragre report is not getting generated.

Below is the details from Build.xml

<!--Emma classpath -->
<path id="emma.lib">
<pathelement location="D:\CI\emma\emma.jar"/>
<pathelement location="D:\CI\emma\emma_ant.jar"/>
<taskdef resource="" classpathref="emma.lib"/>

<!-- Enable Emma -->
<target name="emma" description="turns on EMMA's instrumentation reporting">
<property name="emma.enabled" value="true"/>
<!-- EMMA instr class output directory (it is important to create this property only when EMMA is enabled) -->
<mkdir dir="${dir.instr}"/>
<!-- this property, if overriden via -Demma.filter=<list of filter specs> on ANT's command line, will set the coverage filter; by default, all classes found in 'dir.classes' pathref will be instrumented: -->
<property name="emma.filter" value="*Test"/>
<!-- measure code coverage -->
<target name="coverage" depends="compileEjb">
<emma enabled="${emma.enabled}">
<instr instrpath="${dir.classes}" destdir="${dir.instr}" metadatafile="${dir.coverage}/coverage.emma">
<filter excludes="${emma.filter}"/>
<!-- Junit Tests -->
<target name="test" depends="initApp3,clean,prepare,compileEjb,emma,coverage"
description="Test if the application is working fine">
<junit haltonerror="false" haltonfailure="false" dir="${dir.instr}" showoutput="true">
<path refid="test.classpath"/>
<path path="${dir.instr}"/>
<path refid="emma.lib"/>
<path path="${ejb.test.src}"/>
<batchtest todir="${}">
<fileset dir="${ejb.test.src}">
<include name="**/"/>
<formatter type="xml" usefile="yes"/>
<jvmarg value="-Demma.coverage.out.file=${dir.coverage}/coverage.emma"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
<jvmarg value="-Djava.library.path=${basedir}\\lib"/>
<jvmarg value="-XX:-UseSplitVerifier"/>
<!-- if enabled, generate coverage report(s): -->
<emma enabled="${emma.enabled}">
<report sourcepath="${}" depth="method">
<!-- collect all EMMA data dumps (metadata and runtime) [this can be done via nested <fileset> fileset elements or <file> elements pointing to a single file]: -->
<fileset dir="${dir.coverage}" description="This is to test emma">
<include name="*.emma"/>
<include name="*.ec"/>
<!-- for every type of report desired, configure a nested element; various report parameters can be inherited from the parent <report> and individually overridden for each report type: -->
<txt outfile="${dir.coverage}/coverage.txt" depth="method"/>
<xml outfile="${dir.coverage}/coverage.xml" depth="package"/>
<html outfile="${dir.coverage}/coverage.html" depth="method"/>

Log details
[instr] processing instrumentation path ...
[instr] instrumentation path processed in 108 ms
[instr] [6 class(es) instrumented, 0 resource(s) copied]
[instr] metadata merged into [D:\workspace\Deployment\SIS\coverage\coverage.emma] {in 59 ms}

[junit] dir attribute ignored if running in the same VM
[junit] log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BigDecimalConverter).
[junit] log4j:WARN Please initialize the log4j system properly.
[junit] SLF4J: Class path contains multiple SLF4J bindings.
[junit] SLF4J: Found binding in [jar:file:/C:/OMW121200/wlserver/modules/features/weblogic.server.merged.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[junit] SLF4J: Found binding in [jar:file:/C:/OMW121200/wlserver/modules/org.slf4j.jdk14_1.6.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[junit] SLF4J: See for an explanation.
[junit] Aug 08, 2014 4:51:29 PM org.hibernate.validator.util.Version <clinit>
[junit] INFO: Hibernate Validator
[junit] Aug 08, 2014 4:51:29 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
[junit] INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
[junit] [EL Warning]: transaction: 2014-08-08 16:51:32.442--ServerSession(938694473)--PersistenceUnitInfo Model has transactionType RESOURCE_LOCAL and therefore jtaDataSource will be ignored
[junit] [EL Info]: 2014-08-08 16:51:32.461--ServerSession(938694473)--EclipseLink, version: Eclipse Persistence Services - 2.4.2.v20130514-5956486
[junit] [EL Info]: connection: 2014-08-08 16:51:34.873--ServerSession(938694473)--file:/D:/workspace/Deployment/SIS/hisBuildTest/work/EJB/classes/_Model_url=jdbc:oracle:thin:@ login successful
[junit] Part Name :C 470N 10% 35V 3528 -*
[report] processing input files ...
[report] 1 file(s) read and merged in 77 ms
[report] nothing to do: no runtime coverage data found in any of the data files

Any idea on what condition "no runtime coverage data found in any of the data files" occur.
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!