[英]Running jetty web server before selenide tests
我有多模块Maven项目。 一个父级和两个子模块。 在第一个模块中,我有集成测试,尤其是硒化测试,它正在测试Web应用程序。 Web应用程序在第二个模块中。 我想通过码头服务器部署应用程序,然后在一个maven命令中对其运行硒化测试。 我尝试了更多的解决方案,但是其中很少。
在带有Web应用程序的模块中,我设置了码头插件以在测试之前运行服务器。
<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>
但是问题是插件找不到任何测试,因为它们在其他模块中。
您能告诉我如何设置故障保护以在第一个模块中找到测试吗? 还是其他解决方案,例如从父级运行它?
好吧,我不是专家,也许JUnit @Rule
可以帮助您解决任务:初始化,部署和测试Web应用程序。
看看这个:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.