Closed kraanerk closed 10 years ago
Hello,
What do you mean exactly by gathering code coverage by test.
In our project we are using that extension along with arquiillian-jacoco and we have all data gathered.
Could you provide some test cases or just describe your usage test a bit further.
Hi, We are running Arquillian tests using managed JBoss AS. Some of the tests use embedded database. We use EclipseLink as JPA provider. When running the tests without arquillian-suite-extension everything works (though quite slowly). With arquillian-suite-extension the following error happens: ERROR [org.jboss.as.server](management-handler-thread - 3) JBAS015870: Deploy of deployment "test-embeddedDB.war" was rolled back with the following failure message: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test-embeddedDB.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test-embeddedDB.war\".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment \"test-embeddedDB.war\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011426: Could not deploy application packaged persistence provider 'org.eclipse.persistence.jpa.PersistenceProvider' Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.StackOverflowError"}} The StackOverflowError is caused by the following loop (hundreds of lines like this): at org.jboss.arquillian.extension.jacoco.container.ArquillianRuntime.getInstance(ArquillianRuntime.java) at org.jboss.arquillian.extension.jacoco.container.ArquillianRuntime.$jacocoInit(ArquillianRuntime.java) at org.jboss.arquillian.extension.jacoco.container.ArquillianRuntime.getInstance(ArquillianRuntime.java) at org.jboss.arquillian.extension.jacoco.container.ArquillianRuntime.$jacocoInit(ArquillianRuntime.java)
Hello,
That module itself uses jacoco to check code coverage. And also here Im using managed jboss (in rest of our projects we are using remote). Everything works ok..
Could you write versions of jacoco (both jacoco and arquillian-jacoco) your using.
And could you try running something in your environment but without Eclipse Link? Thats one of thing i surly didnt try (i tried Eclipse Link but with glassfish not Jboss)
Hi,
Did you manage to make it work? Or still have problems?
Hi, Nope, sadly no luck so far. I have stopped trying cause the deadline is very close. I just keep running the tests without the suite extension. Thanks for your help.
I'm actually facing this issue as well. I think the underlying problem is that you're never enriching the archive with test contents. For example, I have to manually include the tests in the suite or else I get injection errors trying to find the test classes.
I exported the generated archive. I am able to see the jacoco extension listed, is it possible for you to link to a working example with JaCoCo? NOte that i'm on 1.0.6.
That project itself uses jacoco to make coverage data possible.. And in tests its using itself to make deployment and single test all..
Could you please post somewhere full test case? I will try to help you..
i have same problem with new jacoco version full pom.xml: `<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.real</groupId>
<artifactId>RflowHR</artifactId>
<version>0.1-SNAPSHOT</version>
<properties>
<argLine>-Xmx2048m</argLine>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
<version.jboss.spec.javaee.7.0>1.0.3.Final</version.jboss.spec.javaee.7.0>
<default.scope>provided</default.scope>
<test.scope>test</test.scope>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>jcenter</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<!-- Define the version of the JBoss Java EE APIs we want to import. Any
dependencies from org.jboss.spec will have their version defined by this
BOM -->
<!-- JBoss distributes a complete set of Java EE APIs including a Bill
of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
of artifacts. We use this here so that we always get the correct versions
of artifacts. Here we use the jboss-javaee-7.0 stack (you can read this as
the JBoss stack of the Java EE APIs). You can actually use this stack with
any version of WildFly that implements Java EE. -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>${version.jboss.spec.javaee.7.0}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.12.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!--plugin> <groupId>org.mock-server</groupId> <artifactId>mockserver-maven-plugin</artifactId>
<version>3.10.4</version> <configuration> <serverPort>1080</serverPort> <proxyPort>1090</proxyPort>
<logLevel>DEBUG</logLevel> <initializationClass>org.mockserver.maven.ExampleInitializationClass</initializationClass>
</configuration> <executions> <execution> <id>process-test-classes</id> <phase>process-test-classes</phase>
<goals> <goal>start</goal> </goals> </execution> <execution> <id>verify</id>
<phase>verify</phase> <goals> <goal>stop</goal> </goals> </execution> </executions>
</plugin -->
<!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version> <executions> <execution> <id>attach-javadocs</id>
<goals> <goal>jar</goal> </goals> <configuration> <sourcepath>src/main/java/</sourcepath>
</configuration> </execution> </executions> </plugin> -->
</plugins>
</build>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.real</groupId>
<artifactId>AofCommon</artifactId>
<version>1.7.7</version>
</dependency>
<!-- validation -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>5.3.4.Final</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<!-- mockserver -->
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>3.10.4</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- SFTP library -->
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.19.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<type>pom</type>
<version>1.0.3.Final</version>
<scope>${default.scope}</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.11.Final</version>
<scope>${default.scope}</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.10.Final</version>
<scope>${default.scope}</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.5</version>
<scope>${default.scope}</scope>
</dependency>
<!-- LOGS -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<!-- TEST SCOPE -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>${test.scope}</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<scope>${test.scope}</scope>
<type>pom</type>
<exclusions>
<!-- eclipse sisu not working with WildFly so exclude it -->
<exclusion>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eu.ingwar.tools</groupId>
<artifactId>arquillian-suite-extension</artifactId>
<version>1.1.2</version>
<scope>${test.scope}</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>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
<goal>report-integration</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>
<configuration>
<failIfNoTests>false</failIfNoTests>
<excludedGroups>org.jboss.arquillian.testng.Arquillian</excludedGroups>
</configuration>
</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>
</profile>
<profile>
<id>deploy-real</id>
<distributionManagement>
<repository>
<id>releases</id>
<name>Internal Releases</name>
<url>http://rs-dev-01.real.net:8180/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://rs-dev-01.real.net:8180/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
`
arquillian.xml:
`<?xml version="1.0" encoding="UTF-8"?> <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->
<defaultProtocol type="Servlet 3.0" />
<!-- Keep generated archive for inspection
-->
<engine>
<property name="deploymentExportPath">target/</property>
</engine>
<extension qualifier="jacoco">
<property name="excludes">*</property>
<container qualifier="jbossas-managed" default="true">
<configuration>
<property name="jbossHome">${env.JBOSS_HOME}</property>
<property name="serverConfig">standalone-real-continuous-integration.xml</property>
<property name="deploymentExportPath">target/arquillian</property>
<property name="javaVmArguments">${argLine},jmx=true,includes=com.real.*</property>
<!-- true : server must be started by the user, false : arquillian will start it itself -->
<property name="allowConnectingToRunningServer">true</property>
<property name="startupTimeoutInSeconds">${startup.timeout:360}</property>
</configuration>
</container>`
If one wants to gather test code coverage with arquillian-jacoco then arquillian-suite-extension can't be used. Their co-existence results in a StackOverflowError.