集成测试无法启动(故障安全,Maven) [英] Integration tests wouldn't start (Failsafe, Maven)

查看:93
本文介绍了集成测试无法启动(故障安全,Maven)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Maven故障保护插件在此配置下运行集成测试:

I'm trying to use Maven Failsafe Plugin to run my integration tests with this configuration:

 <plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.7.1</version>
    <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>

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.7</version>
    <configuration>

          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8080</port>
              <maxIdleTime>3600000</maxIdleTime>
            </connector>
          </connectors>

        <contextPath>/</contextPath>
        <scanIntervalSeconds>3</scanIntervalSeconds>
        <scanTargetPatterns>
            <scanTargetPattern>
                <directory>src/main/webapp/WEB-INF</directory>
                <excludes>
                    <exclude>**/*.jsp</exclude>
                    <exclude>**/*.html</exclude>
                </excludes>
                <includes>
                    <include>**/*.page</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </scanTargetPattern>
        </scanTargetPatterns>
    </configuration>
    <executions>
            <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>run-war</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>

一切都很好,直到在集成前测试阶段启动Jetty为止.然后什么也没有发生,好像它在等待什么.最后一行说:

Everything is fine until Jetty is started in pre-integration-test phase. Then nothing happens, as if it was waiting for something. The last line says:

[INFO] Started Jetty Server

我如何才能使测试立即开始?我使用mvn verify运行maven.

How can I make the tests to start right afterwards? I run maven using mvn verify.

推荐答案

将Jetty Maven插件版本从6.1.7更改为6.1.26可以解决所有问题.

Change of jetty maven plugin version from 6.1.7 to 6.1.26 solved everything.

这篇关于集成测试无法启动(故障安全,Maven)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆