5 Replies Latest reply on May 19, 2014 5:47 PM by pinky shah

    jacoco wildfly setup

    pinky shah Newbie

      I am getting test code coverage 0%.

      How shoud jacoco setup in wildfly.

       

      I followed this documentation. WildFly Integration Testsuite User Guide - WildFly 8 - Project Documentation Editor

      How to pass the arquillan jvm argument.

       

      Please help.

        • 1. Re: jacoco wildfly setup
          Tomaz Cerar Master

          what exactly do you want to do?

           

          inspect wildfly codebase or your application's code that run in wildfly?

          • 2. Re: jacoco wildfly setup
            pinky shah Newbie

            No.

            setup jacoco with wildfly

            I am passing this option -javaagent:[yourpath/]jacocoagent.jar=[option1]=[value1],[option2]=[value2] in wildfly standalone.bat

            Still getting code coverage as 0%.

            Not sure if I am missing Any other setting for wildfly?

            • 3. Re: jacoco wildfly setup
              pinky shah Newbie

              I see that i get coverage if i run client side

              but once i run server side its gives 0%

              • 4. Re: jacoco wildfly setup
                Rich DiCroce Novice

                The Arquillian Jacoco Extension might help you: http://arquillian.org/modules/jacoco-extension/

                 

                Beware: development of that extension is VERY sporadic, documentation is poor, and it's effectively unusable for large deployments due to ARQ-1684.

                • 5. Re: jacoco wildfly setup
                  pinky shah Newbie

                  I already have junit framework.

                   

                  Please find my below configuration for jacoco.

                   

                  I am using

                  1. ant
                  2. junit
                  3. jcoco
                  4. cactus all junit test extend servertest from cactus.

                   

                  standalone.bat

                   

                  set "JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS% -javaagent:{myhome.dir}/jacocoagent.jar=destfile={myhome.dir}/jacoco.exec,excludes=${jboss.home.dir}/modules/**/*,classdumpdir={myhome.dir}/dump,dumponexit=false,append=false"

                   

                   

                  ant tasks:

                   

                  <target name="test">

                          <delete file="jacoco.exec" />

                          <delete dir="${project.dir}/junit" />

                          <mkdir dir="${project.dir}/junit/result" />

                          <mkdir dir="${project.dir}/junit/report" />

                          <jacoco:coverage>

                              <junit fork="true" maxmemory="512M" printsummary="true" haltonerror="false" haltonfailure="false" showoutput="yes">

                                  <jvmarg line="${cactus.args}" />

                                  <classpath>

                                      <path refid="build.classpath1" />

                                  </classpath>

                                  <formatter type="xml" />

                                  <batchtest todir="${project.dir}/junit/result">

                                      <fileset dir="{JBOSS.HOME}\standalone\deployments\flexnet.ear\flexnet.war\WEB-INF\classes" includes="**/DumyTest*" excludes="${test.exclude.files}" />

                                  </batchtest>

                              </junit>

                          </jacoco:coverage>

                          <junitreport tofile="TestResults.xml" todir="${project.dir}/junit/result">

                              <fileset dir="${project.dir}/junit/result" />

                              <report format="frames" todir="${project.dir}/junit/report" />

                          </junitreport>

                      </target>

                   

                      <target name="test-coverage-report">

                          <delete dir="${project.dir}/code-coverage" />

                          <jacoco:report>

                              <executiondata>

                                  <file file="jacoco.exec" />

                              </executiondata>

                              <structure name="Code Coverage Results">

                                  <group name="FNO">

                                      <classfiles>

                                          <fileset dir="{JBOSS.HOME}\standalone\deployments\flexnet.ear\flexnet.war\WEB-INF\classes" />

                                      </classfiles>

                                      <sourcefiles encoding="UTF-8">

                                          <fileset dir="${src.dir}" />

                                          <fileset dir="${testsrc.dir}" />

                                      </sourcefiles>

                                  </group>

                              </structure>

                              <html destdir="${project.dir}/code-coverage" />

                          </jacoco:report>

                      </target>