我有多模块 Maven 项目。一个父模块和两个子模块。在第一个模块中,我进行了集成测试,特别是硒测试,它们正在测试 Web 应用程序。Web 应用程序位于第二个模块中。我想通过码头服务器部署应用程序,然后在一个 Maven 命令中对其运行硒测试。我尝试了更多的解决方案,这里只是其中的几个。
在带有网络应用程序的模块中,我设置了码头插件以在测试前运行服务器。
<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>
和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>
但问题是插件找不到任何测试,因为它们在其他模块中。
你能告诉我如何设置故障安全以在第一个模块中查找测试吗?或其他解决方案,例如从 parent 运行它?