When runnning mvn test, my spring boot application builds succesfully. When I do mvn clean install or mvn clean verify, build fails. This is because I have minimum code coverage ratio configured to 80%. When I run mvn clean install/verify, the result shows instructions covered ratio is 0.00, but expected minimum is 0.50.
Before setting the minimum threshold, running mvn clean install, gave the below result, which says 65% covered. What is missing in my configuration? Am I missing anything? How can I get jacoco pick the correct code covered?
Here is my pom
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<version>0.8.5</version>
<classifier>runtime</classifier>
<scope>test</scope>
</dependency>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<dependencies>
<dependency>
<groupId>com.github.bitmc</groupId>
<artifactId>checkstyle</artifactId>
<version>8.35.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<excludes>
<exclude>com.pip</exclude>
</excludes>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.50</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
I am using java version "1.8.0_202"
In you's plugin config need set like that;
`
...
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<configuration>
<excludes>
<exclude>**/PACKEGE YOU WANT EXCLUDE.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>65%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
`
in your's exemple the tag pluguin is out from plugins tag.
If you are using Jacoco with PowerMockito, and the class which you want to cover is taken in PrepareForTest, then in that case it will show you 0% coverage.
Try removing the target class from PrepareForTest
Related
I have a package, com.org.projectname.model, in my project. What I want to do is exclude all the files within this package from SonarQube coverage. I tried,
<exclude>**/model /*.class</exclude> and <exclude>**/com/org/projectname/model/*.class</exclude>, but this didn't work.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<configuration>
<excludes>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>target/coverage-data/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/coverage-data/jacoco-ut.exec</dataFile>
<outputDirectory>target/coverage-reports/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
How to fix this issue? Or is there any other way?
Have you tried using sonar.exclusions in your POM properties?
<properties>
<sonar.exclusions>
**/model/*.java
</sonar.exclusions>
</properties>
Consider the follow build configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefireArgLine}</argLine>
<parallel>all</parallel>
<threadCount>2</threadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>${failsafeArgLine}</argLine>
<parallel>classes</parallel>
<threadCount>2</threadCount>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-it.exec</destFile>
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
And reporting configuration:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<id>JaCoCo-UnitTest</id>
<reports>
<report>report</report>
</reports>
<configuration>
<dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
</configuration>
</reportSet>
<reportSet>
<id>JaCoCo-IntegrationTest</id>
<reports>
<report>report</report>
</reports>
<configuration>
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
</configuration>
</reportSet>
</reportSets>
</plugin>
The awesome part is mvn clean site works awesome, I get my reports. However, this now means that the JaCoCo agent is starting during the normal lifecycle, ie: mvn clean install verify.
Is there a way to disable the JaCoCo agent during the normal lifecycle but not the site cycle?
Simply skip the JaCoCo execution using a property:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Skip this phase if jacoco.skip property is set to true -->
<skip>${jacoco.skip}</skip>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Skip this phase if jacoco.skip property is set to true -->
<skip>${jacoco.skip}</skip>
<dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
You can also disable JaCoCo execution when tests are skipped:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>${surefireArgLine}</argLine>
<!-- Skip tests if skip.unit.tests property is set to true -->
<skipTests>${skip.unit.tests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Skip this phase if unit tests are skipped -->
<skip>${skip.unit.tests}</skip>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Skip this phase if unit tests are skipped -->
<skip>${skip.unit.tests}</skip>
<dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
I have written a unit test case using JUnit now I want to add JaCoCo in my build tool that is moving 3.2.1.I am new to Maven. While adding it, I have to doubt that I want to add it in the dependency or plugin ? There are both are available,such that is following
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2-SNAPSHOT</version>
</plugin>
<dependency>
<groupId>org.codehaus.sonar.plugins</groupId>
<artifactId>sonar-jacoco-plugin</artifactId>
<version>3.2.1</version>
</dependency>
I desire to append it in the dependency is it enough for the plugin?
Please any body clarify it
JaCoCo Java Code Coverage Library
JaCoCo is a free code coverage library for Java, which has been created by the EclEmma team based on the lessons learned from using and integration existing libraries for many years. Example
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<skip>false</skip>
<check/>
<rules>
<rule>
<element>CLASS</element>
<excludes>
<exclude>*Test</exclude>
</excludes>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.50</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/jacoco</outputDirectory>
</configuration>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<check>
<instructionRatio>100</instructionRatio>
<branchRatio>95</branchRatio>
<lineRatio>90</lineRatio>
<methodRatio>90</methodRatio>
<classRatio>90</classRatio>
</check>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
GitHUb rpository JaCoCo
Projects that use JaCoCo
Maven Surefire Plugin
Maven Release Plugin
You need to add something like the below to your <build><plugins>:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.20</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
That should generate you coverage reports in target/site/jacoco when you build your project with i.e. mvn clean install site
Note in my example plugin configuration the COVEREDRATIO limit is very low, you might want to set a higher value like 80 or so. The idea is to let a build fail if coverage is below that limit.
Add this 2 plugins to pom.xml file. Before adding these plugins make sure you add the dependencies "junit-jupiter-api" and "junit-jupiter-engine". You can find generated HTML file on target > site > jacoco > index.html.
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
Here is a complete pom that will help you:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>dummyJar</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>dummyJar</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.1.201405082137</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The report will be at this location:
/target/site/jacoco/index.html
And see this location for all goals and their config params:
http://www.eclemma.org/jacoco/trunk/doc/maven.html
I have maven profile set for testing where in pre-integration-tests maven starts two jetty servers and afterwards tests are started. The problem I've stumbled into is in the servers, they aren't fully loaded when tests start. It seems like the problem is fixed by adding 5 second sleep time into the tests, but I wish to add it in maven and remove from tests. Is there anyway I could do that? Please look into code sample below for additional information
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.work.projectname</groupId>
<artifactId>projectname-web</artifactId>
<version>${project.version}</version>
<type>war</type>
<destFileName>projectname-${project.version}.war</destFileName>
</artifactItem>
<artifactItem>
<groupId>com.work.projectname</groupId>
<artifactId>projectname-stubs-web</artifactId>
<version>${project.version}</version>
<type>war</type>
<destFileName>projectname-stubs-${project.version}.war</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-server.version}</version>
<executions>
<execution>
<id>start-projectname</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy-war</goal>
</goals>
<configuration>
<daemon>true</daemon>
<reload>manual</reload>
<war>${project.build.directory}/projectname-${project.version}.war</war>
<webAppXml>${basedir}/src/jetty/jetty-loginService.xml</webAppXml>
<webAppConfig>
<contextPath>/projectname</contextPath>
<parentLoaderPriority>true</parentLoaderPriority>
<tempDirectory>${project.build.directory}/tmp-projectname</tempDirectory>
</webAppConfig>
<stopPort>8006</stopPort>
<stopKey>STOP</stopKey>
</configuration>
</execution>
<execution>
<id>start-projectname-stubs</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy-war</goal>
</goals>
<configuration>
<daemon>true</daemon>
<reload>manual</reload>
<war>${project.build.directory}/projectname-stubs-${project.version}.war</war>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>${stub-jetty-server.port}</port>
<maxIdleTime>300000</maxIdleTime>
</connector>
</connectors>
<stopPort>8008</stopPort>
<stopKey>STOP</stopKey>
</configuration>
</execution>
<execution>
<id>stop-projectname</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<stopPort>8006</stopPort>
<stopKey>STOP</stopKey>
</configuration>
</execution>
<execution>
<id>stop-projectname-stubs</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<stopPort>8008</stopPort>
<stopKey>STOP</stopKey>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<parallel>classes</parallel>
<threadCountClasses>33</threadCountClasses>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
You can do it with the help of the maven antrun plugin. Something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<sleep seconds="5" />
</tasks>
</configuration>
<executions>
<execution>
<id>sleep-for-a-while</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
EDIT: In case someone will catch this. Based on the comment from jl, tasks have indeed been deprecated and here is the same thing based on using targets instead. Sligthly reorganized but has the same function.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>sleep-for-a-while</id>
<phase>pre-integration-test</phase>
<configuration>
<target>
<sleep seconds="5" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I have created a maven-sleep-plugin once. Not sure how much it works now, you can try and let us know.
Usage (after checking out the source and building):
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-sleep-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>sleep-5-seconds</id>
<phase>pre-integration-test</phase>
<goals>
<goal>sleep</goal>
</goals>
<configuration>
<delay>5</delay>
</configuration>
</execution>
</executions>
</plugin>
i use maven cargo and selenium for automation. here is the code:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.5</version>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat6x</containerId>
<zipUrlInstaller>
<url>
http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip
</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
<output>
${project.build.directory}/tomcat6x.log
</output>
<log>${project.build.directory}/cargo.log</log>
</container>
<configuration>
<home>
${project.build.directory}/tomcat6x/container
</home>
<properties>
<cargo.logging>high</cargo.logging>
<cargo.servlet.port>8081</cargo.servlet.port>
</properties>
<files>
<copy>
<file>${project.basedir}/src/main/resources/datasource.properties</file>
<todir>webapps</todir>
<configfile>true</configfile>
<overwrite>true</overwrite>
</copy>
</files>
<properties>
<customMessage>${catalina.home}</customMessage>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>configure</goal>
<goal>start</goal>
<goal>deploy</goal>
</goals>
<configuration>
<deployer>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<pingURL>**the url**</pingURL>
<pingTimeout>180000</pingTimeout>
<properties>
<context>**war-name**</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
but as the war started getting bigger the pingtimeout started to increase, i dont want to use ping timeout, but i am being forced to at the moment, as deployment takes a bit of time and selenium does not wait if the pingtimeout is not mentioned.
is there any solution to this problem?
What about using Jetty? The maven-jetty-plugin will wait until your webapp is loaded. Alternatively, you can use the tomcat-maven-plugin and its deploy goal to deploy your webapp to a running Tomcat instance through the Tomcat Manager. This plugin will also wait with the execution (and therefore the launch of your Selenium tests) until the war is deployed.
This is my configuration. It will launch Jetty, deploy the application, launch Selenium, launch Selenium tests and finally quits all the servers:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<configuration>
<background>true</background>
</configuration>
<executions>
<execution>
<id>start-selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
</execution>
<execution>
<id>stop-selenium</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>selenium-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*SeleniumTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>