2012-01-24 5 views
2

의 데이터가 여기 내 지점입니다 : 내가 얻을 mvn clean install -rf testsuite -DallTests -Dcoverage -fae 내가 실행하면 https://github.com/OndraZizka/jboss-as/tree/TS-jacoco코드 커버리지, 나는 7 AS 보스의 범위를 얻으려고 jacoco.exec 파일

(거의) 빈 jacoco.exec 파일 - 그냥 일부 메타 데이터 (크기는 몇 바이트입니다). 사용 JVM을의 인수 라인은 다음과 같습니다

-javaagent:${jbossas.ts.dir}/target/jacoco-jars/agent/jacocoagent.jar=destfile=${basedir}/target/jacoco.exec,includes=${jboss.home}/modules/**/*,excludes=${basedir}/target/classes/**/*,append=true,output=file 

이 줄은 7 있는 TestSuite는 인수가 (이 AS7의 boot.log에 나타납니다)에 전달되지만되고, 실행되는 보스를 시작하는 데 사용할 Arquillian에 전달된다 결과적으로 jacoco.exec 파일의 크기는 몇 바이트에 지나지 않습니다. 물론 보고서에는 적용 범위가 표시되지 않습니다.

내가 뭘 잘못하고 있니?

+0

jboss-7.x는 의미가 없습니다. JBoss는 회사의 한 부서입니다. 마치 "microsoft-XP"라는 태그가있는 것과 같습니다. "jboss-as7"태그를 보관하십시오. 또는 jboss-7.x 태그의 이름을 jboss-as7로 변경하십시오. –

+0

[tag : jboss] [tag wiki] (http://stackoverflow.com/tags/jboss/info)를 보시기 바랍니다. 이 태그는 JBoss Application Server에 사용됩니다. 우리는 단지 새로운 태그가 필요하지 않습니다. 이미 JBoss Application Server 버전 7.x *를 다루는 태그가 있습니다. 우리는 새로운 태그가 필요하지 않습니다. – Charles

답변

2

해결됨 - 에이전트의 "includes"및 "excludes"매개 변수는 파일이 아니라 클래스 이름을 참조합니다. 내 경우에 대한

올바른 JVM 에이전트 인수는 다음과 같습니다

-javaagent:${jbossas.ts.dir}/target/jacoco-jars/agent/jacocoagent.jar=destfile=${basedir}/target/jacoco.exec,includes=*,excludes=org.jboss.as.test.*,append=true,output=file 

내 aproach가 인수를 얻기 위해 받는다는 jacoco 플러그인을 구성, 그리고 재산에 의해 발생하기 때문에 다음의 pom.xml에 속성을 하드 코딩 플러그인은 Surefire 플러그인으로 전달되지 않습니다.

<profile> 
     <id>ts.jacoco.profile</id> 
     <activation><property><name>coverage</name></property></activation> 
     <properties> 
      <jvm.args.jacoco>-javaagent:${jbossas.ts.dir}/target/jacoco-jars/agent/jacocoagent.jar=destfile=${basedir}/target/jacoco.exec,includes=*,excludes=org.jboss.as.test.*,append=true,output=file</jvm.args.jacoco> 
     </properties> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.jacoco</groupId> 
        <artifactId>jacoco-maven-plugin</artifactId> 
        <version>${version.jacoco.plugin}</version> 
        <executions> 
         <execution><id>ts.jacoco-prepare</id> 
          <phase>process-test-classes</phase> 
          <goals><goal>prepare-agent</goal></goals> 
          <configuration> 
           <append>true</append> 
           <destFile>target/jacoco.exec</destFile> 
           <includes> 
            <include>*</include> 
           </includes> 
           <excludes> 
            <exclude>org.jboss.as.test.*</exclude> 
           </excludes> 
           <output>file</output> 
           <propertyName>jvm.args.jacoco</propertyName> 
          </configuration> 
         </execution> 
         <!-- Doesn't work currently - waiting for JaCoCo to fix this. Moved to the Ant plugin execution. --> 
         <execution><id>ts.jacoco.report</id> 
          <phase>none</phase> <!-- post-integration-test --> 
          <goals><goal>report</goal></goals> 
          <configuration> 
           <dataFile>target/jacoco.exec</dataFile> 
           <outputDirectory>target/coverageReport</outputDirectory> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
       <!-- Copy JaCoCo jars to have them for the Ant plugin. --> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-dependency-plugin</artifactId> 
        <executions> 
         <!-- Copy the ant tasks jar. Needed for ts.jacoco.report-ant . --> 
         <execution> <id>ts.jacoco.dep.ant</id> <goals><goal>copy</goal></goals> <phase>process-test-resources</phase> <inherited>false</inherited> 
          <configuration> 
           <artifactItems> 
            <artifactItem><groupId>org.jacoco</groupId><artifactId>org.jacoco.ant</artifactId><version>${version.jacoco.plugin}</version></artifactItem> 
           </artifactItems> 
           <stripVersion>true</stripVersion> 
           <outputDirectory>${basedir}/target/jacoco-jars</outputDirectory> 
          </configuration> 
         </execution> 
         <!-- Copy the agent jar. Needed for ${jvm.args.jacoco} to have this jar on known path. 
          If the ts.jacoco-prepare worked and really put the value into the property, this might go away. --> 
         <execution> <id>ts.jacoco.dep.agent</id> <goals><goal>unpack</goal></goals> <phase>process-test-resources</phase> <inherited>false</inherited> 
          <configuration> 
           <artifactItems> 
            <artifactItem><groupId>org.jacoco</groupId><artifactId>org.jacoco.agent</artifactId><version>${version.jacoco.plugin}</version></artifactItem> 
           </artifactItems> 
           <stripVersion>true</stripVersion> 
           <outputDirectory>${basedir}/target/jacoco-jars/agent</outputDirectory> 
          </configuration> 
         </execution> 

        </executions> 
       </plugin> 
       <!-- Ant plugin. --> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-antrun-plugin</artifactId> 
        <executions> 
         <!-- DEBUG --> 
         <execution> 
          <id>ts.jacoco.debug</id> 
          <phase>post-integration-test</phase> 
          <goals><goal>run</goal></goals> 
          <inherited>false</inherited> 
          <configuration> 
           <target> 
            <echo>Jacoco argline: ${jvm.args.jacoco}</echo> 
            <echo>Jacoco jar: ${basedir}/target/jacoco-jars/org.jacoco.ant.jar</echo> 
           </target> 
          </configuration> 
         </execution> 
         <!-- Must be run using Ant due to https://sourceforge.net/tracker/?func=detail&aid=3474708&group_id=177969&atid=883354 --> 
         <execution> 
          <id>ts.jacoco.report-ant</id> 
          <phase>site</phase> <!-- post-integration-test --> 
          <goals><goal>run</goal></goals> 
          <inherited>false</inherited> 
          <configuration> 
           <target> 
            <taskdef name="report" classname="org.jacoco.ant.ReportTask"> 
             <classpath path="${basedir}/target/jacoco-jars/org.jacoco.ant.jar"/> 
            </taskdef> 
            <echo>Creating JaCoCo test coverage reports...</echo> 
            <mkdir dir="${basedir}/target/coverage-report"/> 
            <report> 
             <executiondata> 
              <fileset dir="${basedir}"> 
               <include name="**/target/jacoco.exec"/> 
              </fileset> 
             </executiondata> 
             <structure name="AS 7 project"> 
              <classfiles> 
               <fileset dir="${jboss.dist}/modules"> 
                <include name="**/*.jar"/> 
                <!-- We have 2.x in main. --> 
                <exclude name="com/sun/jsf-impl/1.*/**/*"/> 
                <!-- AS7-3383 - com/sun/codemodel vs. /1.0/com/sun/codemodel --> 
                <exclude name="com/sun/xml/**/*"/> 
                <exclude name="javax/faces/api/1.2/**/*"/> 
                <!-- AS7-3390 --> 
                <exclude name="org/apache/commons/beanutils/**/*"/> 
                <!-- AS7-3389 --> 
                <exclude name="org/python/jython/standalone/**/*"/> 
               </fileset> 
              </classfiles> 
              <sourcefiles encoding="UTF-8"> 
               <fileset dir="${jbossas.project.dir}"> 
                <include name="**/*.java"/> 
                <exclude name="testsuite/**/*.java"/> 
               </fileset> 
              </sourcefiles> 
             </structure> 
             <html destdir ="${basedir}/target/coverage-report/html"/> 
             <xml destfile="${basedir}/target/coverage-report/coverage-report.xml"/> 
             <csv destfile="${basedir}/target/coverage-report/coverage-report.csv"/> 
            </report> 
           </target> 
          </configuration> 
         </execution> 
        </executions> 
        <dependencies> 
         <dependency> 
          <groupId>org.jacoco</groupId> 
          <artifactId>org.jacoco.ant</artifactId> 
          <version>${version.jacoco.plugin}</version> 
         </dependency> 
        </dependencies> 
       </plugin> 
      </plugins> 
     </build> 
    </profile> 
+0

+1 업데이트 된 제외 목록을 게시하고 pl을 포함 할 수 있습니까? 또한 jacoco가 커버리지를 표시하기 위해 소스 코드에 액세스해야한다고 생각하십니까? –

+0

업데이트가 더 많아서 "너무 지역화 된"폐쇄로 이어질 가능성이 높습니다. – casperOne