JBoss AS 7 testsuite的代码覆盖率,使用JaCoCo-JaCoCo.exec文件中没有数据
我正试图获得JBoss AS 7的报道。这是我的分支: 当我运行JBoss AS 7 testsuite的代码覆盖率,使用JaCoCo-JaCoCo.exec文件中没有数据,jboss,code-coverage,jacoco,jboss7.x,Jboss,Code Coverage,Jacoco,Jboss7.x,我正试图获得JBoss AS 7的报道。这是我的分支: 当我运行mvn clean install-rf testsuite-DallTests-Dcoverage-fae时,我得到(几乎)空的jacoco.exec文件-只有一些元数据(大小为几个字节)。 使用的JVM参数行是: -javaagent:${jbossas.ts.dir}/target/jacoco-jars/agent/jacocoagent.jar=destfile=${basedir}/target/jacoco.exec
mvn clean install-rf testsuite-DallTests-Dcoverage-fae
时,我得到(几乎)空的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
这一行被传递给Arquillian,用于启动JBoss AS 7。
testsuite运行时,参数被传递(它出现在AS7的boot.log中),但生成的jacoco.exec
文件的大小只有几个字节。报告当然没有报道
我做错了什么?已解决-代理的“包含”和“排除”参数指的是类名,而不是文件
我的案例中正确的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
我的建议是配置maven 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>
ts.jacoco.profile
新闻报道
-javaagent:${jbossas.ts.dir}/target/jacocojars/agent/jacocoagent.jar=destfile=${basedir}/target/jacoco.exec,includes=*,excludes=org.jboss.as.test.*,append=true,output=file
org.jacoco
jacocomaven插件
${version.jacoco.plugin}
T.jacoco-prepare
过程测试类
配制剂
真的
target/jacoco.exec
*
org.jboss.as.test*
文件
jvm.args.jacoco
ts.jacoco.报告
没有一个
报告
target/jacoco.exec
目标/覆盖范围报告
org.apache.maven.plugins
maven依赖插件
ts.jacoco.dep.ant复制过程测试资源错误
org.jacocorg.jacoco.ant${version.jacoco.plugin}
真的
${basedir}/target/jacoco jars
ts.jacoco.dep.agent解包过程测试资源错误
org.jacocorg.jacoco.agent${version.jacoco.plugin}
真的
${basedir}/target/jacoco jars/agent
org.apache.maven.plugins
maven antrun插件
ts.jacoco.debug
整合后测试
跑
假的
Jacoco argline:${jvm.args.Jacoco}
jacocojar:${basedir}/target/jacocojars/org.Jacoco.ant.jar
ts.jacoco.report-ant
场地
跑
假的
正在创建JaCoCo测试覆盖率报告。。。