如何在开始测试

时间:2016-04-22 09:42:44

标签: java continuous-integration tomcat7 pom.xml

经过两天的搜索,我仍然无法在测试前运行tomcat,有人能说出我做的不对吗?这是我的pom

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.16</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.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
    <server>tomcat-development-server</server>
    <port>8081</port>
    <path>/test</path>
</configuration>
<executions>
    <execution>
        <id>start-tomcat</id>
        <phase>pre-integration-test</phase>
        <goals>
            <goal>run</goal>
        </goals>
    </execution>
    <execution>
        <id>stop-tomcat</id>
        <phase>post-integration-test</phase>
        <goals>
            <goal>shutdown</goal>
        </goals>
    </execution>
</executions>

当我使用mvn验证我的测试开始,但服务器没有,我不知道我错过了什么!

1 个答案:

答案 0 :(得分:0)

我通过在预集成测试阶段添加此代码来解决问题

<configuration>
        <fork>true</fork>
</configuration>