Search code examples
javacode-coveragejmockit

Unable to get Code Coverage Report using jmockit coverage jar


I have been using jmockit coverage while testing locally available jars in eclipse. But when I am trying to put the jmockit coverage jar on remote node with tomcat running, where I am deploying many of the jars. I am unable to generate coverage report for the same.

Emma works fine for remote coverage but wanted to use jmockit coverage for remote as well, because it is a bit more easier approach.


Solution

  • <target name="Jmockit" >
            <junit fork="yes" forkmode="once" >
                <classpath refid="class.path" />
                <sysproperty key="jmockit-coverage-output" value="html" />
                <jvmarg value="-javaagent:../jmockit.jar"/> // path of Jmockit jar
                <formatter type="brief" usefile="false"/>
                <batchtest >
                    <fileset dir ="${testdir}" includes="**/*.class" />
                </batchtest>
            </junit>
        </target>
    

    Do something this .

    Give the path of ${testdir}, your classpath reference and path of Jmockit.jar in this task..