0

I have multi module maven project. One parent and two submodules. In first module I have integration tests, specifically selenide tests, which are testing web application. Web application is in the second module. I want to deploy application via jetty server and then run selenide tests on it in one maven command. I have tried more solutions and here are few of them.

In the module with web app I set up jetty plugin to run server before tests.

 <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
      <contextPath>web-app</contextPath>
        <stopPort>8005</stopPort>
        <stopKey>STOP</stopKey>
    </configuration>
    <executions>
      <execution>
        <id>start-jetty</id>
        <phase>pre-integration-test</phase>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <daemon>true</daemon>
        </configuration>
      </execution>
      <execution>
        <id>stop-jetty</id>
        <phase>post-integration-test</phase>
        <goals>
          <goal>stop</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

and failsafe-maven-plugin.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>failsafe-maven-plugin</artifactId>
    <version>2.4.3-alpha-1</version>
    <executions>
      <execution>
        <goals>
          <goal>integration-test</goal>
          <goal>verify</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

But problem is that plugin not find any tests because they are in other module.

Can you tell me how to set up failsafe to find test in first module ? Or other solution for example run it from parent ?

Verhagen
  • 3,673
  • 23
  • 35
Mário Jaroš
  • 131
  • 1
  • 7
  • why not having the war module as dependency in the test module and start jetty in the test module, where actually the tests are, so that everything will be in one place? – A_Di-Matteo Mar 18 '16 at 12:52

1 Answers1

0

Well, I'm not an expert, maybe JUnit @Rule is that can help you to solve your task: to initialise, deploy and test your web app.

Have a look at this:

How does Junit @Rule work?

JUnit Rules Wiki

Here is described Rule to start a Jetty Server

Community
  • 1
  • 1