Maven + Jacoco + Arquillian + TestNG IT test = stackoverflowError

时间:2017-01-20 09:36:14

标签: integration-testing code-coverage jboss-arquillian wildfly-9 jacoco-maven-plugin

我使用的是最后一个版本的jacoco-maven-plugin(0.7.8)和最后一个版本的arquillian-jacoco(1.0.0.Alpha9)但是在执行IT测试时我在BeforeClass Arquillian中有一个stackOverFlowError(我正在使用maven,testNG,wildfly,jacoco,arquillian都在最新的图书馆中):

Tests run: 12, Failures: 1, Errors: 0, Skipped: 11, Time elapsed: 54.616 sec     <<< FAILURE! - in com.real.hr.services.impl.test.PayEseConnectorServiceImplIT
arquillianBeforeClass(com.real.hr.services.impl.test.PayEseConnectorServiceImplIT)  Time elapsed: 54.263 sec  <<< FAILURE!
org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy: arquillian-RflowHR.war
Caused by: java.lang.Exception: 

"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"arquillian-RflowHR.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"arquillian-RflowHR.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"arquillian-RflowHR.war\"
Caused by: java.lang.StackOverflowError"

测试失败:   PayEseConnectorServiceImplIT&gt; Arquillian.arquillianBeforeClass:109»部署

当我评论时:

<dependency>
    <groupId>org.jboss.arquillian.extension</groupId>
    <artifactId>arquillian-jacoco</artifactId>
    <version>1.0.0.Alpha9</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.jacoco</groupId>
    <artifactId>org.jacoco.core</artifactId>
    <version>0.7.8</version>
    <scope>test</scope>
</dependency> 

它工作正常但不是我的配置下面的集成测试:

<!-- jacoco -->
<dependency>
    <groupId>org.jboss.arquillian.extension</groupId>
    <artifactId>arquillian-jacoco</artifactId>
    <version>1.0.0.Alpha9</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.jacoco</groupId>
    <artifactId>org.jacoco.core</artifactId>
    <version>0.7.8</version>
    <scope>test</scope>
</dependency>
</dependencies>
<profiles>
 <profile>
        <id>test-coverage</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.7.8</version>
                    <executions>
                         <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>            
                    </executions>
                </plugin>

            </plugins>
        </build>
    </profile>
    <profile>
        <id>integration-tests-wildfly</id>
        <build>
            <plugins>
             <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
            </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <jboss.server.log.dir>${jboss.home.dir}/standalone/log</jboss.server.log.dir>
                            <arquillian.launch>jbossas-managed</arquillian.launch>
                            <jbossas.startup.timeout>240</jbossas.startup.timeout>
                        </systemPropertyVariables>
                        <includes>
                            <include>**/*IT.java</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.arquillian</groupId>
                <artifactId>wildfly-arquillian-container-managed</artifactId>
                <version>2.0.2.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

任何帮助?

1 个答案:

答案 0 :(得分:0)

在arquillian.xml中添加以下代码对我有用:

 <extension qualifier="jacoco">
    <property name="includes">com.your.top.package.*</property>
</extension>

事实上,只有你的课程才会在仪器中使用