3

I have a maven project with some Arquillian Tests (Drone/Graphene Tests included).

When I build my project using maven all my Arquillian Tests that use Graphene and Drone or Warp will fail with following exception

Running de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.862 sec <<< FAILURE! - in de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest
de.mmo.arq.model.diverses.stammdaten.geldinstitut.GeldinstitutBlzTest  Time elapsed: 4.862 sec  <<< ERROR!
org.jboss.shrinkwrap.api.exporter.ArchiveExportException: Failed to write asset to output: /WEB-INF/classes/de/mmo/base/dao/CrudService.class
Caused by: java.lang.IncompatibleClassChangeError: class org.jacoco.core.internal.flow.ClassProbesVisitor has interface org.objectweb.asm.ClassVisitor as super class

This is the place where the magic should happen

<build>
    <finalName>browser</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <tagBase>...</tagBase>
                <useReleaseProfile>false</useReleaseProfile>
            </configuration>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>jacoco</id>
        <dependencies>
            <dependency>
                <groupId>org.jacoco</groupId>
                <artifactId>org.jacoco.core</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>arq-wildfly</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire}</version>
                    <configuration>
                        <skipTests>false</skipTests>
                        <systemPropertyVariables>
                            <arquillian.launch>wildfly-remote</arquillian.launch>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>default</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire}</version>
                    <configuration>
                        <skipTests>true</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>${wildfly.maven-plugin}</version>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

I'm using mvn to build my project with this goals clean package -fae with this profiles jacoco arq-wildfly

The build fails and the jacoco.exec file is created at my target directory.

If I remove the goal prepare-agent in the jacoco profile and run the same mvn command (clean package -fae) with the profiles jacoco arq-wildfly all my tests finish successfull but without creating the jacoco.exec file.

What I'm doing wrong? Does someone have a working example using Arquillian with Drone/Graphene Tests and Jacoco for code coverage?

For additional information about my environment:

  • Wildfly 10
  • Arquillian Core 1.1.11.Final
  • Arquillian Drone 1.3.1.Final
  • Arquillian Graphene 2.1.0.Beta1
  • Arquillian Jacoco 1.0.0.Alpha8
  • Jacoco 0.7.6.201602180812

1 Answer 1

6

You have a multiple asm versions on your classpath, jacoco needs the most recent one.

Use mvn dependency:tree to find the asm versions, I think you have asm:asm and org.ow2.asm:asm-debug-all in your dependencies.

Exclude the old version (asm:asm) with the following for the dependency which needs asm:

<dependency>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <exclusions>
        <exclusion>
            <artifactId>asm</artifactId>
            <groupId>asm</groupId>
        </exclusion>
    </exclusions>
</dependency>

For drone it would be something like this:

<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>graphene-webdriver</artifactId>
    <type>pom</type>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <artifactId>asm</artifactId>
            <groupId>asm</groupId>
        </exclusion>
    </exclusions>
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.