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 ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Emma Code Coverage Implementation Issue  RSS feed

 
Greenhorn
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"/>
</path>
<taskdef resource="emma_ant.properties" 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"/>
</target>
<!-- 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}"/>
</instr>
</emma>
</target>
<!-- 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">
<classpath>
<path refid="test.classpath"/>
<path path="${dir.instr}"/>
<path refid="emma.lib"/>
<path path="${ejb.test.src}"/>
</classpath>
<batchtest todir="${test.report.dirxml}">
<fileset dir="${ejb.test.src}">
<include name="**/ReportTest.java"/>
</fileset>
</batchtest>
<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"/>
</junit>
<!-- if enabled, generate coverage report(s): -->
<emma enabled="${emma.enabled}">
<report sourcepath="${test.report.dirxml}" 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"/>
</fileset>
<!-- 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"/>
</report>
</emma>
</target>

Log details
coverage:
[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}

test:
[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 http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[junit] Aug 08, 2014 4:51:29 PM org.hibernate.validator.util.Version <clinit>
[junit] INFO: Hibernate Validator 12.1.2.0.0
[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:@10.47.33.243:1521:HISDEV_user=hisapp 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
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!