没有找到运行时覆盖率数据



我不能定义为什么emma不生成运行时覆盖率数据。

我在运行测试时忘记了什么?基于这篇文章:如何使用EMMA代码覆盖率更改Ant脚本,以便它可以找到运行时覆盖率数据?

我把工具化的类放在类路径的顶部

ant-emma.xml:

<!-- ====================================================================-->
<!-- EMMA SETUP -->
<!-- ====================================================================-->
<project name="Emma" basedir="." >
    <property file="./emma.properties" />
    <property name="emma.lib.dir"  location="${emma.home}/lib" />
    <property name="emma.build.dir" location="${build.dir}/emma" />
    <property name="emma.instr.dir" location="${emma.build.dir}/target" />
    <!-- directory which emma instrumentation classes will be written to -->
    <property name="emma.instr.src.dir" location="${emma.instr.dir}/src" />
    <property name="emma.instr.test.dir" location="${emma.instr.dir}/test" />
    <property name="emma.report.dir" location="${emma.build.dir}/report" />
    <!-- directory which emma coverage reports will be written to -->
    <property name="emma.data.dir" location="${emma.report.dir}/data" />
    <property name="emma.runtime.coverage.data.file" location="${emma.data.dir}/coverage.ec" />
    <property name="emma.coverage.merged.dir" location="${emma.data.dir}/final" />
    <property name="emma.coverage.file" location="${emma.coverage.merged.dir}/coverage-final.emma" />
    <property name="emma.filter" value="" />
    <path id="emma.lib.path" >
        <pathelement location="${emma.lib.dir}/emma.jar" />
        <pathelement location="${emma.lib.dir}/emma_ant.jar" />
    </path>
    <!-- Define which classes will be reported in the coverage reports (by default, we will include all classes and assume -->
    <!-- that your project's output folder is target/classes -->
    <path id="emma.coverage.classes" >
        <pathelement location="${build.src.dir}" />
        <pathelement location="${build.test.dir}" />
    </path>
    <path id="classpath.emma.run" >
        <pathelement location="${emma.instr.src.dir}" />
        <pathelement location="${emma.instr.test.dir}" />
        <pathelement location="${build.test.dir}" />
        <pathelement location="${build.src.dir}" />
        <path refid="classpath.src.compile" />
        <path refid="emma.lib.path" />
    </path>
    <taskdef resource="emma_ant.properties" classpathref="emma.lib.path" />
    <target name="emma-clean" >
        <delete includeemptydirs="true" quiet="false" verbose="false" failonerror="true" dir="${emma.report.dir}"  />
        <delete includeemptydirs="true" quiet="false" verbose="false" failonerror="true" dir="${emma.instr.dir}"  />
        <delete includeemptydirs="true" quiet="false" verbose="false" failonerror="true" dir="${emma.build.dir}"  />
    </target>
    <target name="emma-init" depends="emma-clean">
        <mkdir dir="${emma.build.dir}" />
        <mkdir dir="${emma.report.dir}" />
        <mkdir dir="${emma.instr.dir}" />
        <mkdir dir="${emma.report.dir}" />
        <mkdir dir="${emma.data.dir}" />
        <mkdir dir="${emma.coverage.merged.dir}" />
    </target>
    <target name="emma-turn-on" description="turns on EMMA instrumentation/reporting">
        <property name="emma.enabled" value="true" />
        <property name="emma.verbosity.level" value="verbose" />
    </target>
    <target name="emma-instrumentation-src" depends="emma-turn-on, emma-init" description="do EMMA's src instrumentation">
        <emma enabled="${emma.enabled}" verbosity="${emma.verbosity.level}" >
            <instr
                instrpath="${build.src.dir}"
                destdir="${emma.instr.src.dir}"
                metadatafile="${emma.data.dir}/metadata-src.em"
                merge="true"
                mode="fullcopy"
                >
                <filter value="${emma.filter.src}" />
            </instr>
        </emma>
    </target>
    <target name="emma-instrumentation-test" depends="emma-turn-on, emma-init" description="do EMMA's test instrumentation">
        <emma enabled="${emma.enabled}" verbosity="${emma.verbosity.level}" >
            <instr
                instrpath="${build.test.dir}"
                destdir="${emma.instr.test.dir}"
                metadatafile="${emma.data.dir}/metadata-test.em"
                merge="true"
                mode="fullcopy"
                >
                <filter value="${emma.filter.test}" />
            </instr>
        </emma>
    </target>
    <target name="run-emma-instrumentation" depends="emma-instrumentation-src, emma-instrumentation-test" />
    <target name="emma-instrumentation" depends="emma-init, run-emma-instrumentation" description="do EMMA's merge instrumentation" />
    <target name="emma-do-test" depends="emma-instrumentation" >
        <junit printsummary="yes" haltonfailure="true" fork="true" >
            <classpath>
                <path refid="classpath.emma.run" />
            </classpath>
            <formatter type="plain" usefile="false" />
            <batchtest todir="${emma.report.dir}" >
                <fileset dir="${test.src.dir}" includes="**/*Test.java" />
            </batchtest>
            <jvmarg value="-Demma.coverage.out.file=${emma.runtime.coverage.data.file}" />
            <jvmarg value="-Demma.coverage.out.merge=true" />
        </junit>
        <echo message="Emma Test Result : ${emma.report.dir}" />
        <echo message="Emma file : ${emma.runtime.coverage.data.file}" />
    </target>
    <target name="emma-run-instrumentation-merge" depends="emma-do-test" description="do EMMA's instrumentation">
        <emma enabled="${emma.enabled}" verbosity="${emma.verbosity.level}" >
            <merge outfile="${emma.coverage.file}" >
                <fileset dir="${emma.data.dir}" includes="*.em, *.ec" />
            </merge>
        </emma>
    </target>
    <target name="emma-run-report" depends="emma-run-instrumentation-merge" >
        <emma enabled="${emma.enabled}" verbosity="${emma.verbosity.level}">
            <report sourcepath="${src.dir}" depth="all" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100" >
                <fileset dir="${emma.coverage.merged.dir}" >
                    <include name="*.emma" />
                </fileset>
                <xml outfile="${emma.report.dir}/coverage.xml" depth="all" columns="class,method,block,line,name" />
                <txt outfile="${emma.report.dir}/coverage.txt" depth="all" columns="class,method,block,line,name" />
                <html outfile="${emma.report.dir}/coverage.html" depth="all" columns="class,method,block,line,name" />
            </report>
        </emma>
    </target>
    <target name="run-emma" depends="emma-run-report" />
</project>
输出:

emma-run-instrumentation-merge:
    [merge] [EMMA v2.0, build 5312 (2005/06/12 19:32:43)]
    [merge] input data path:
    [merge] {
    [merge]   C:TempbuildsExampleemmareportdatametadata-src.em
    [merge]   C:TempbuildsExampleemmareportdatametadata-test.em
    [merge] }
    [merge] processing input file [C:TempbuildsExampleemmareportdatametadata-src.em] ...
    [merge]   loaded 40 metadata entries
    [merge] processing input file [C:TempbuildsExampleemmareportdatametadata-test.em] ...
    [merge]   loaded 3 metadata entries
    [merge] 2 file(s) read and merged in 20 ms
    [merge]   merged metadata contains 43 entries
    [merge] merged/compacted data written to [C:TempbuildsExampleemmareportdatafinalcoverage-final.emma] {in 0 ms}
emma-run-report:
   [report] [EMMA v2.0, build 5312 (2005/06/12 19:32:43)]
   [report] input data path:
   [report] {
   [report]   C:TempbuildsExampleemmareportdatafinalcoverage-final.emma
   [report] }
   [report] source path:
   [report] {
   [report]   D:wkpAppUtilssrc
   [report] }
   [report] processing input file [C:TempbuildsExampleemmareportdatafinalcoverage-final.emma] ...
   [report]   loaded 43 metadata entries
   [report] 1 file(s) read and merged in 0 ms
   [report] nothing to do: no runtime coverage data found in any of the data files
run-emma:
BUILD SUCCESSFUL
Total time: 7 seconds

OUTPUT WITH DEBUG:

emma-do-test:
        [junit] Couldn't find junit/framework/TestCase.class
        [junit] Found D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar
        [junit] Found D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar
        [junit] Found D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar
        [junit] Found D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar
    fileset: Setup scanner in dir D:wkpAppUtilslibs with patternSet{ includes: [**/*.jar] excludes: [] }
    Finding class junit.framework.Test
    Loaded from D:wkpAppUtilslibsjunit-4.11.jar junit/framework/Test.class
    Class java.lang.Object loaded from parent loader (parentFirst)
    Class junit.framework.Test loaded from ant loader (parentFirst)
    Finding class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirrorImpl
    Loaded from D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirrorImpl.class
    Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror loaded from parent loader (parentFirst)
    Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror$SummaryJUnitResultFormatterMirror loaded from parent loader (parentFirst)
    Class java.lang.Throwable loaded from parent loader (parentFirst)
    Finding class junit.framework.AssertionFailedError
    Loaded from D:wkpAppUtilslibsjunit-4.11.jar junit/framework/AssertionFailedError.class
    Class java.lang.AssertionError loaded from parent loader (parentFirst)
    Class junit.framework.AssertionFailedError loaded from ant loader (parentFirst)
    Class java.lang.ClassLoader loaded from parent loader (parentFirst)
    Class org.apache.tools.ant.AntClassLoader loaded from parent loader (parentFirst)
    Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror$JUnitTestRunnerMirror loaded from parent loader (parentFirst)
    Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask loaded from parent loader (parentFirst)
    fileset: Setup scanner in dir D:wkpAppUtilstest with patternSet{ includes: [**/*Test.java] excludes: [] }
        [junit] Implicitly adding D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar to CLASSPATH
        [junit] Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
        [junit] '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
        [junit] '-Demma.coverage.out.merge=false'
        [junit] '-classpath'
        [junit] 'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
        [junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
        [junit] 'app.commons.enums.TypeFileSizeTest'
        [junit] 'filtertrace=true'
        [junit] 'haltOnError=false'
        [junit] 'haltOnFailure=true'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
        [junit] 'showoutput=false'
        [junit] 'outputtoformatters=true'
        [junit] 'logfailedtests=true'
        [junit] 'logtestlistenerevents=false'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.enums.TypeFileSizeTest.txt'
        [junit] 'crashfile=D:wkpAppUtilsantemmajunitvmwatcher3180808930350880484.properties'
        [junit] 'propsfile=D:wkpAppUtilsantemmajunit6882722104357253846.properties'
        [junit] 
        [junit] The ' characters around the executable and arguments are
        [junit] not part of the command.
    Execute:Java13CommandLauncher: Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
    '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
    '-Demma.coverage.out.merge=false'
    '-classpath'
    'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
    'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
    'app.commons.enums.TypeFileSizeTest'
    'filtertrace=true'
    'haltOnError=false'
    'haltOnFailure=true'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
    'showoutput=false'
    'outputtoformatters=true'
    'logfailedtests=true'
    'logtestlistenerevents=false'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.enums.TypeFileSizeTest.txt'
    'crashfile=D:wkpAppUtilsantemmajunitvmwatcher3180808930350880484.properties'
    'propsfile=D:wkpAppUtilsantemmajunit6882722104357253846.properties'
    The ' characters around the executable and arguments are
    not part of the command.
        [junit] Running app.commons.enums.TypeFileSizeTest
        [junit] Tests run: 8, Failures: 0, Errors: 0, Time elapsed: 0.026 sec
        [junit] Implicitly adding D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar to CLASSPATH
        [junit] Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
        [junit] '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
        [junit] '-Demma.coverage.out.merge=false'
        [junit] '-classpath'
        [junit] 'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
        [junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
        [junit] 'app.commons.utils.AppFileUtilsTest'
        [junit] 'filtertrace=true'
        [junit] 'haltOnError=false'
        [junit] 'haltOnFailure=true'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
        [junit] 'showoutput=false'
        [junit] 'outputtoformatters=true'
        [junit] 'logfailedtests=true'
        [junit] 'logtestlistenerevents=false'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.utils.AppFileUtilsTest.txt'
        [junit] 'crashfile=D:wkpAppUtilsantemmajunitvmwatcher4273539226127863796.properties'
        [junit] 'propsfile=D:wkpAppUtilsantemmajunit7675821937325699249.properties'
        [junit] 
        [junit] The ' characters around the executable and arguments are
        [junit] not part of the command.
    Execute:Java13CommandLauncher: Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
    '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
    '-Demma.coverage.out.merge=false'
    '-classpath'
    'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
    'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
    'app.commons.utils.AppFileUtilsTest'
    'filtertrace=true'
    'haltOnError=false'
    'haltOnFailure=true'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
    'showoutput=false'
    'outputtoformatters=true'
    'logfailedtests=true'
    'logtestlistenerevents=false'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.utils.AppFileUtilsTest.txt'
    'crashfile=D:wkpAppUtilsantemmajunitvmwatcher4273539226127863796.properties'
    'propsfile=D:wkpAppUtilsantemmajunit7675821937325699249.properties'
    The ' characters around the executable and arguments are
    not part of the command.
        [junit] Running app.commons.utils.AppFileUtilsTest
        [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.239 sec
        [junit] Implicitly adding D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar to CLASSPATH
        [junit] Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
        [junit] '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
        [junit] '-Demma.coverage.out.merge=false'
        [junit] '-classpath'
        [junit] 'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
        [junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
        [junit] 'app.commons.utils.AppSystemUtilsTest'
        [junit] 'filtertrace=true'
        [junit] 'haltOnError=false'
        [junit] 'haltOnFailure=true'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
        [junit] 'showoutput=false'
        [junit] 'outputtoformatters=true'
        [junit] 'logfailedtests=true'
        [junit] 'logtestlistenerevents=false'
        [junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.utils.AppSystemUtilsTest.txt'
        [junit] 'crashfile=D:wkpAppUtilsantemmajunitvmwatcher2828995806384576666.properties'
        [junit] 'propsfile=D:wkpAppUtilsantemmajunit7199116178610816128.properties'
        [junit] 
        [junit] The ' characters around the executable and arguments are
        [junit] not part of the command.
    Execute:Java13CommandLauncher: Executing 'C:AppJavajdk1.7.0_79jrebinjava.exe' with arguments:
    '-Demma.coverage.out.file=c:tempbuildsAppUtilsemmareportdatacoverage.ec'
    '-Demma.coverage.out.merge=false'
    '-classpath'
    'c:tempbuildsAppUtilsemmatargetsrc;c:tempbuildsAppUtilsemmatargettest;c:tempbuildsAppUtilstest;c:tempbuildsAppUtilssrc;D:wkpAppUtilslibshibernate-jpa-2.0-api-1.0.1.Final.jar;D:wkpAppUtilslibsjoda-time-2.1.jar;D:wkpAppUtilslibsjunit-4.11.jar;D:wkpAppUtilslibsmockito-all-1.9.5.jar;D:wkpAppUtilsantemmalibemma.jar;D:wkpAppUtilsantemmalibemma_ant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-launcher.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit.jar;D:Appeclipse-kepler-x64-V3.apluginsorg.apache.ant_1.8.4.v201303080030libant-junit4.jar'
    'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
    'app.commons.utils.AppSystemUtilsTest'
    'filtertrace=true'
    'haltOnError=false'
    'haltOnFailure=true'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
    'showoutput=false'
    'outputtoformatters=true'
    'logfailedtests=true'
    'logtestlistenerevents=false'
    'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter,c:tempbuildsAppUtilsemmareportTEST-app.commons.utils.AppSystemUtilsTest.txt'
    'crashfile=D:wkpAppUtilsantemmajunitvmwatcher2828995806384576666.properties'
    'propsfile=D:wkpAppUtilsantemmajunit7199116178610816128.properties'
    The ' characters around the executable and arguments are
    not part of the command.
        [junit] Running app.commons.utils.AppSystemUtilsTest
        [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.019 sec
         [echo] Emma Test Result : c:tempbuildsAppUtilsemmareport
         [echo] Emma file : c:tempbuildsAppUtilsemmareportdatacoverage.ec

当您使用错误的命令生成报告时,会得到此错误。大多数在线教程都提倡错误的(可能是旧的)命令,甚至当我使用下面的命令生成报告时也出现了这个错误:

<>之前{JAVA_HOME}jrelibext>java -cp emma.jar emma report -r html -in coverage。哦,{ALFRESCO_HOME} coverage.ec处理输入文件…EMMA:在60毫秒内读取并合并1个文件EMMA:无事可做:没有在任何数据文件中找到运行时覆盖数据之前

命令的正确用法是(标记命令中有额外的"-in"):

<>之前{JAVA_HOME}jrelibext>java -cp emma.jar emma report -r txt,html -in {JAVA_HOME}jrelibextcoverage。em - C:t1_tempSetupAlfrescocoverage.ec处理输入文件…EMMA:在70毫秒内读取并合并2个文件EMMA:写入[txt]报告到[{JAVA_HOME}jrelibextcoverage.txt]…EMMA:写[html]报告到[{JAVA_HOME}jrelibextcoverageindex.html]

第一次运行这个程序时,出现了以下错误::

    [junit] Running app.commons.enums.TypeFileSizeTest
    [junit] Testsuite: app.commons.enums.TypeFileSizeTest
    [junit] Tests run: 8, Failures: 0, Errors: 8, Time elapsed: 0.04 sec
    [junit] Tests run: 8, Failures: 0, Errors: 8, Time elapsed: 0.04 sec
    [junit] Testcase: POS_TEST_CONVERT_TO_EB took 0 sec
    [junit]     Caused an ERROR
    [junit] Expecting a stackmap frame at branch target 11
    [junit] Exception Details:
    [junit]   Location:
    [junit]     app/commons/enums/TypeFileSize.<init>(Ljava/lang/String;ILjava/lang/Integer;)V @4: ifnonnull
    [junit]   Reason:
    [junit]     Expected stackmap frame at this location.
    [junit]   Bytecode:
    [junit]     0000000: b200 8c59 c700 0757 b800 9605 323a 042a
    [junit]     0000010: 2b1c b700 62a 2db5 0007 1904 0304 54b1
    [junit]     0000020:   

事实上,我做了一个非常糟糕的假设,我做这件事的方式是错误的…

经过几天的思考和浪费一些时间来理解这个问题……我找到了解决方案:在VM中添加一个参数:(对不起,我把参考资料弄丢了…)
<jvmarg value="-XX:-UseSplitVerifier" />

-最后我只需要修改我的'emma-do-test'任务:

<target name="emma-do-test" depends="emma-instrumentation" >
    <junit printsummary="withOutAndErr" haltonfailure="true" fork="true"  >
        <classpath>
            <path refid="classpath.emma.run" />
        </classpath>
        <formatter type="plain" usefile="false" />
        <batchtest todir="${emma.report.dir}" >
            <fileset dir="${test.src.dir}" includes="**/*Test.java" />
        </batchtest>
        <jvmarg value="-XX:-UseSplitVerifier" />
        <jvmarg value="-Demma.coverage.out.file=${emma.runtime.coverage.data.file}" />
        <jvmarg value="-Demma.coverage.out.merge=false" />
    </junit>
    <echo message="Emma Test Result : ${emma.report.dir}" />
    <echo message="Emma file : ${emma.runtime.coverage.data.file}" />
</target>

相关内容

  • 没有找到相关文章

最新更新