On Wednesday, May 25, 2016 at 6:25:33 AM UTC+1, [email protected] wrote:
> Hi 
> 
> I've been trying to configure Jacoco with cucumber tests initiated via Maven.
> 
> When I run the build it fails with a 'multiple tests running in parallel 
> within the same jvm' error 
> 
> I've played about with all the fork properties to no avail.
> 
> Has anyone got an example Pom that works?

Hi Barry,

To get cucumber working you dont really need to do much with the pom file at 
all except include the dependencies, and set up the failsafe plugin and jacoco 
plugin for coverage in the usual way.

<dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-spring</artifactId>
             <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
             <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>   


<plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-failsafe-plugin</artifactId>
                                <version>${failsafe.version}</version>
                                <executions>
                                        <execution>
                                                <id>default</id>
                                                <goals>
                                                        
<goal>integration-test</goal>
                                                        <goal>verify</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <!-- Sets the jacoco VM argument line 
used when integration tests are 
                                                run. -->
                                        <argLine>${failsafeArgLine}</argLine>

                                        <!-- Skips integration tests if the 
value of skip.integration.tests 
                                                property is true -->
                                        
<skipTests>${skip.integration.tests}</skipTests>

                                        <!-- Set the path to the phantom js 
binary file which is used to act 
                                                as a headless browser when 
running selenium driven integration tests: See 
                                                setPhantomJSDriver() method in 
GeneralIT.java -->
                                        <systemPropertyVariables>
                                                
<phantomjs.binary>${phantomjs.binary}</phantomjs.binary>
                                        </systemPropertyVariables>
                                        <includes>
                                                <include>**/*IT*</include>
                                        </includes>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.jacoco</groupId>
                                <artifactId>jacoco-maven-plugin</artifactId>
                                <version>${jacoco.version}</version>
                                <executions>
                                        <!-- Prepares the property pointing to 
the JaCoCo runtime agent which 
                                                is passed as VM argument when 
the Maven Failsafe plugin is executed. Prepare 
                                                agent is by default bound to 
the maven default life cycle initialize phase -->
                                        <execution>
                                                <id>pre-integration-test</id>
                                                <!-- Binds to initialize phase 
by default -->
                                                <phase>initialize</phase>
                                                <goals>
                                                        
<goal>prepare-agent</goal>
                                                </goals>
                                                <configuration>
                                                        <!-- Sets the path to 
the file which contains the execution data. -->
                                                        
<destFile>${jacoco-IT-test-exec-path}</destFile>
                                                        <includes>
                                                                
<include>uk/co/**</include>
                                                        </includes>
                                                        <!-- Seems to ignore 
this now -->
                                                        <excludes>
                                                                
<exclude>**/*IT*</exclude>
                                                                
<exclude>uk/co/netart/config/*</exclude>
                                                                
<exclude></exclude>
                                                        </excludes>
                                                        <!-- Sets the name of 
the property containing the settings for JaCoCo 
                                                                runtime agent. 
This is so the failsafe plugin knows where the IT jacoco exec 
                                                                file is. -->
                                                        
<propertyName>failsafeArgLine</propertyName>
                                                </configuration>
                                        </execution>
                                        <!-- By default the jacoco:report goal 
is bound to the verify phase 
                                                of the default life cycle -->
                                        <execution>
                                                <id>post-integration-test</id>
                                                <phase>verify</phase>
                                                <goals>
                                                        <goal>report</goal>
                                                </goals>
                                                <configuration>
                                                        <!-- Sets the path to 
the file which contains the execution data. -->
                                                        
<dataFile>${jacoco-IT-test-exec-path}</dataFile>
                                                        <!-- Sets the output 
directory for the code coverage report. -->
                                                        
<outputDirectory>${jacoco-IT-test-report-directory}</outputDirectory>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>                                       



Sorry about the comments but you can just remove them.

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/5a7d0213-2117-4119-8d5a-43307851125e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to