Jacoco Coverage and Report Task with Ant

Hopefully I am posted all the necessary details about this build file. Coverage task works fine and all the test cases runs.

Jacoco.exec is also generated but report task fails stating Unable to read execution data file C:/path/to/file/jacoco.exec.

Cant figure out what I am doing wrong. Any additions or alternative way ??

<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
    <classpath path="${JACOCO.HOME}/lib/jacocoant.jar"/>
</taskdef>

<target name="runtest" depends="compile">
    <jacoco:coverage destfile="${testdest}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" exclclassloader="sun.reflect.DelegatingClassLoader:javassist.Loader" >
        <junit haltonfailure="yes" fork="true" forkmode="once" printsummary="on">
            <classpath refid="project.classpath" />
            <classpath location="${testdest}" />
            <formatter type="xml"/>
            <batchtest fork="yes">
                <fileset dir="${testdest}" />
            </batchtest>
        </junit>
    </jacoco:coverage>

    <jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
        <executiondata>
            <file file="${testdest}/jacoco.exec" />
        </executiondata>

        <structure name="Jacoco">
            <classfiles>
                <fileset dir="${dest}" />
            </classfiles>
            <sourcefiles encoding="UTF-8">
                <fileset dir="${src}" />
            </sourcefiles>
        </structure>

        <html destdir="${testsrc}/report" />
    </jacoco:report>

Answers


Well above stated code works perfectly. What went wrong was, I tried to run the build file too many times due to this the existing jacoco.exec was corrupt(due to failed Junit test i think) and it was not being executed. I deleted the jacoco.exec file and ran the file again which generated new jacoco.exec file which executed perfectly.


Need Your Help

raspberry pi easycap dc 60 capture problems

raspberry-pi raspbian mplayer

I am trying to capture video over EasyCap DC60 stk1160 (yellow cable) but on my raspbian 3.10.25 (raspberry pi) in mplayer video looks like this (green and messed video, artefacts):