【问题标题】:run junit tests on war file before deploying to weblogic在部署到 weblogic 之前对 war 文件运行 junit 测试
【发布时间】:2014-09-08 05:43:30
【问题描述】:

我有一些测试 RESTful Web 服务的 junit 测试用例。我正在使用 Maven 来构建战争。如何在 maven 生成的 war 文件上运行这些 RESTful Web 服务测试用例,然后再将其部署到 weblogic 应用程序服务器。请帮忙。

【问题讨论】:

  • 这些单元测试是集成测试。

标签: maven testing weblogic


【解决方案1】:

您可以使用 pre-integration-test、integration-test 和 post-integration-test 阶段来启动 servlet 引擎,如 jetty/tomcat 等,然后通过 maven-failsafe-plugin 对您的服务运行集成测试。 您需要相应地命名测试。

<project>
  [...]
  <build>
    [...]
    <plugins>
      [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.17</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>

docs of maven-failsafe-plugin 你还会发现一个启动码头的例子......

【讨论】:

    猜你喜欢
    • 2013-05-31
    • 2015-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多