Not able to start Jetty in pre-integration-test phase Not able to start Jetty in pre-integration-test phase selenium selenium

Not able to start Jetty in pre-integration-test phase


You used maven-surefire-plugin which run unit tests. But in your case, you want to run integration tests.

You have to use the maven-fail-safeplugin in order to run integration tests. This plugin has two goals: integration-test & verify, integrated in the maven lifecycle:

  • pre-integration-test
  • integration-test
  • post-integration-test
  • verify

So in your case use something like:

<plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-failsafe-plugin</artifactId>  <executions>    <execution>      <phase>integration-test</phase>      <goals>        <goal>integration-test</goal>      </goals>    </execution>    <configuration>     ...    </configuration>  </executions></plugin>

Hope that helps.


I cant see anything wrong with your jetty-maven-plugin configuration but how do you handle the Selenium Configuration? Do you have a plugin configuration in that direction?:

<plugin>    <groupId>org.codehaus.mojo</groupId>    <artifactId>selenium-maven-plugin</artifactId>    <version>${your.selenium.version}</version>    <executions>        <execution>            <id>start-selenium</id>            <phase>pre-integration-test</phase>            <goals>                <goal>start-server</goal>            </goals>            <configuration>                <background>true</background>            </configuration>        </execution>        <execution>            <id>stop-selenium</id>            <phase>post-integration-test</phase>            <goals>                <goal>stop-server</goal>            </goals>        </execution>    </executions></plugin>

Then make sure to have the same port for your Jetty server as for your Selenium Testcases (Selenium uses 4444 as default port), e.g. either the default port of 8080 or another port configured with <port>xy</port> in the jetty plugin. In case of the default port it would look something like this:

new DefaultSelenium(“localhost”,4444,“*firefox”,“http://localhost:8080″);