1
0
-1

Hi Avoka Team,

Is it possible to have our CI server produce a code coverage report? IntelliJ provides this capability but we can't utilise it from within Ant.

Thanks,

Sean

    CommentAdd your comment...

    3 answers

    1.  
      2
      1
      0

      Hi Sean

      Have you tried Jacoco?

      https://www.eclemma.org/jacoco/trunk/doc/ant.html

      Regards
      Rado

        CommentAdd your comment...
      1.  
        1
        0
        -1

        We have not given a try much but one may create a similar task:

        <project name="my-project" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
        
            <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
                <classpath path="path_to/lib/jacocoant.jar" />
            </taskdef>
        
            <target name="jacoco-task">
                
                <jacoco:coverage destfile="target/jacoco.exec">
                    <junit fork="true" forkmode="once">
                    <test name="com.mycompany.svc.ServiceTest"/>
                    <test  ... />
                    <test  ... />
                    <classpath>
                        <pathelement location="./bin"/>
                        <fileset dir="path_to_sdk/lib">
                            <include name="**/*.jar" />
                        </fileset>
                    </classpath>
                    <formatter type="brief" usefile="false"/>
                </jacoco:coverage>
        
                <jacoco:report>
                    <executiondata>
                        <file file="target/jacoco.exec"/>
                    </executiondata>
                    <structure name="My Project">
                        <classfiles>
                            <fileset dir="./bin"/>
                        </classfiles>
                        <sourcefiles encoding="UTF-8">
                            <fileset dir="src"/>
                        </sourcefiles>
                    </structure>
                    <html destdir="target/jacoco-report"/>
                </jacoco:report>
            </target>
        </project>
          CommentAdd your comment...
        1.  
          1
          0
          -1

          Hi Rado,

          I did briefly try wrapping the svc-test and job in the build.xml with the Jacoco tags but I got an error telling me that it wasn't permitted. If this is how you are doing it would you mind sharing some configs?

          Thanks,

          Sean

            CommentAdd your comment...