【问题标题】:Maven + Jacoco + Arquillian +TestNG IT test = stackoverflowErrorMaven + Jacoco + Arquillian +TestNG IT 测试 = stackoverflowError
【发布时间】:2017-06-05 05:50:36
【问题描述】:

我正在使用 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>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>

有什么帮助吗?

【问题讨论】:

  • 也许我在我的 ArquillianDeploymentHelper 中有一条线索: File[] libs = pom.importDependencies(scopes).resolve().using(TransitiveStrategy.INSTANCE).asFile(); WebArchive archive = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME) .addAsLibraries(libs),我认为 jacoco 尝试检测所有库类,这会导致服务器中的 stackoverflowError 我不知道如何配置为在运行时不执行,因为 jacoco 报告没有所有的库,只有我的测试类

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


【解决方案1】:

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

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

实际上只有你的类会被用于检测

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-16
    • 2019-05-02
    • 1970-01-01
    • 2014-09-22
    • 1970-01-01
    • 2016-09-25
    • 2012-09-03
    • 1970-01-01
    相关资源
    最近更新 更多