Menu

Unable to get HTML Reports

2006-04-06
2013-05-09
  • Nobody/Anonymous

    With emma im able to instrument the files but im unable to get the  report ,plz check this build file.

    compile:

    run:
        [instr] processing instrumentation path ...
        [instr] instrumentation path processed in 140 ms
        [instr] [0 class(es) instrumented, 0 resource(s) copied]
        [instr] no output created: metadata is empty
         [java] EMMA: collecting runtime coverage data ...
         [java] EMMA: runtime coverage data written to [D:\test\SourceCode\coverage\cover
    age.emma] {in 31 ms}

       [report] processing input files ...
       [report] java.io.IOException: cannot read [D:\test\SourceCode\coverage\coverage.em
    ma]: created by another EMMA version [2.0.5312]
       [report]     at com.vladium.emma.data.DataFactory.mergeload(DataFactory.java:387)
       [report]     at com.vladium.emma.data.DataFactory.load(DataFactory.java:56)
       [report]     at com.vladium.emma.report.ReportProcessor._run(ReportProcessor.java:
    176)
       [report]     at com.vladium.emma.Processor.run(Processor.java:88)
       [report]     at com.vladium.emma.report.reportTask.execute(reportTask.java:77)
       [report]     at com.vladium.emma.emmaTask.execute(emmaTask.java:58)
       [report]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:30
    6)
       [report]     at org.apache.tools.ant.Task.perform(Task.java:401)
       [report]     at org.apache.tools.ant.Target.execute(Target.java:338)
       [report]     at org.apache.tools.ant.Target.performTasks(Target.java:365)
       [report]     at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
       [report]     at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
       [report]     at org.apache.tools.ant.Main.runBuild(Main.java:669)
       [report]     at org.apache.tools.ant.Main.startAnt(Main.java:220)
       [report]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
       [report]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)

     
    • Vlad Roubtsov

      Vlad Roubtsov - 2006-04-06

      [report] java.io.IOException: cannot read [D:\test\SourceCode\coverage\coverage.em
      ma]: created by another EMMA version [2.0.5312]

      This should be a clue. Looks like you have two versions of EMMA going on. Do a clean build, make sure you have a single version of EMMA everywhere (e.g, <jre dir>/lib/ext and whatever location ANT uses to load emma.jar, etc) and try again.

       
    • Nobody/Anonymous

      Thxs Vlad,its working.

       
    • Nobody/Anonymous

      Allready some class files are there im trying to instrumnet that class files ,but im unable to get report.If compile,instrument then im able to get the report.Plz check this build.xml file.

      D:\test\SourceCode>ant -f build-offline.xml emma all
      Buildfile: build-offline.xml

      emma:

      init:
           [echo] D:/libs/

      run:
          [instr] processing instrumentation path ...
          [instr] instrumentation path processed in 391 ms
          [instr] [0 class(es) instrumented, 18 resource(s) copied]
          [instr] no output created: metadata is empty
           [java] EMMA: collecting runtime coverage data ...
           [java] EMMA: runtime controller started on port [47653]
           [java] EMMA: locking coverage output file [D:\test\SourceCode\coverage\coverage.
      emma] ...
           [java] EMMA: runtime coverage data written to [D:\test\SourceCode\coverage\cover
      age.emma] {in 31 ms}

         [report] processing input files ...
         [report] 1 file(s) read and merged in 0 ms
         [report] nothing to do: no metadata found in any of the data files

      merge:
          [merge] processing input files ...
          [merge] 1 file(s) read and merged in 0 ms
          [merge] merged/compacted data written to [D:\test\SourceCode\coverage\session.emm
      a] {in 32 ms}

      all:

       
    • Vlad Roubtsov

      Vlad Roubtsov - 2006-04-07

      You are not actually showing any build.xml content, rather the console output...

       
    • Nobody/Anonymous

      hai,
      See this Build.xml file.
      <?xml version="1.0"?>
      <!-- ============= build file for ANT v1.x [requires v1.4+] ========= -->

      <project name="EMMA demo (offline mode)" default="all" basedir="." >

      <description>
              simple example build file
          </description>

        <!-- the default target compiles and runs Main: -->
        <target name="all" depends="init,run,merge" />

        <target name="clean" description="resets this demo project to a clean state" >
          <delete dir="${out.dir}" />
          <delete dir="${basedir}/outinstr" />
          <delete dir="${coverage.dir}" />
        </target>
       
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

        <target name="init" >

        <!-- root directory for the example source code:  -->
        <property name="src.dir" value="${basedir}/src" />
        <!-- javac class output directory: -->
        <property name="out.dir" value="${basedir}/out" />

        <!-- output directory used for EMMA coverage reports: -->
        <property name="coverage.dir" value="${basedir}/coverage" />

        <!-- directory that contains emma.jar and emma_ant.jar: -->
        <property name="emma.dir" value="D:/libs/" />

        <!-- path element used by EMMA taskdef below: -->
        <path id="emma.lib">
          <pathelement location ="${emma.dir}/emma.jar"/>
          <pathelement location ="${emma.dir}/emma_ant.jar"/>
         </path>

         <echo>${emma.dir}</echo>

        <!-- this loads <emma> and <emmajava> custom tasks: -->

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>

          <mkdir dir="${out.dir}" />
          <path id="run.classpath" >
            <pathelement location="${out.dir}" />
          <fileset dir="D:/test/SourceCode/lib">
              <include name="**/*.jar"/>
              <include name="**/*.properties"/>
          </fileset>
          <pathelement location="D:/test/SourceCode/lib"/>
          <!--pathelement location="D:/test/SourceCode/resources" / -->
         </path>

        </target>

        <target name="emma" description="turns on EMMA's instrumentation/reporting" >
       
            <property name="emma.enabled" value="true" />
         
              <property name="out.instr.dir" value="${basedir}/outinstr" />
              <mkdir dir="${out.instr.dir}" />
         
              <property name="emma.filter" value="" />
        </target>
       
        <!-- <target name="compile" depends="init" description="compiles the example source code" >
       
       
          <javac debug="on" srcdir="${src.dir}" destdir="${out.dir}" >
          <classpath>
                      
                      <fileset dir="D:/test/Eclipse Plug-in/lib">
                      <include name="**/*.jar"/>
                      </fileset>
              </classpath>
                 
          </javac>
       
        </target> -->
         

        <target name="run" depends="init" description="runs the examples" >
         
       
        <emma enabled="${emma.enabled}" >
       
            <instr instrpathref="run.classpath"
                   destdir="${out.instr.dir}"          
                   metadatafile="${coverage.dir}/metadata.emma"
                   merge="true"  mode="overwrite"
                >
       
            <filter value="${emma.filter}" />
           
            </instr>
          </emma>

          <!-- run Main. In v2.0, EMMA coverage data is dumped on JVM exit. For
               this to happen the JVM must be forked:
          -->
          <java classname="com.ibsplc.reviewer.CodeReviewer" fork="true" >
            <classpath>
              <!-- instrumented classes must be first in the classpath: -->
              <pathelement location="${out.instr.dir}" />
              <path refid="run.classpath" />
              <!-- the forked JVM must have jact.jar in the classpath: -->
              <path refid="emma.lib" />
            </classpath>
            <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" />
            <jvmarg value="-Demma.coverage.out.merge=false" />
          </java>

          <!-- ${src.dir}if enabled, generate coverage report(s): -->
          <emma enabled="${emma.enabled}" >
            <report sourcepath="D:/test/SourceCode/src"
                    sort="+block,+name,+method,+class"
                    metrics="method:70,block:80,line:80,class:100"
            >
              <fileset dir="${coverage.dir}" >
                <include name="*.emma" />
              </fileset>

              <txt outfile="${coverage.dir}/coverage.txt"
                   depth="package"
                   columns="class,method,block,line,name"
              />
             
              <html outfile="${coverage.dir}/coverage.html"
                   depth="method"
                   columns="name,class,method,block,line"
              />
             
              <xml outfile="${coverage.dir}/coverage.doc"
                       depth="package"
              />
            </report>
          </emma>
        </target>

        <!-- Merging -->

       
        <target name="merge" description="demonstrates dump file merging" >
          <emma>
            <merge outfile="${coverage.dir}/session.emma">
              
              <fileset dir="${coverage.dir}" >
                <include name="*.emma" />
              </fileset>
            </merge>
          </emma>
        </target>

      </project>
      <!-- ========= END OF FILE ========================================== -->

       
    • Vlad Roubtsov

      Vlad Roubtsov - 2006-04-16

      Change 'merge' attribute of the <instr> task to be 'false' and try again after a clean build.

       

Log in to post a comment.