在Maven的集成测试期间启动外部进程 [英] Starting external process during integration testing in maven

查看:206
本文介绍了在Maven的集成测试期间启动外部进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为Maven项目完全自动化的集成测试。集成测试需要一个外部(依赖于平台的)程序运行之前启动。理想地,该外部程序将被杀死之后,单元测试完成后,但不是必要的。

I want completely automated integration testing for a Maven project. The integration tests require that an external (platform-dependent) program is started before running. Ideally, the external program would be killed after the unit tests are finished, but is not necessary.

有一个Maven插件来完成这项工作?其他的想法?

Is there a Maven plugin to accomplish this? Other ideas?

推荐答案

您可以使用的 antrun 插件。在里面你会使用蚂蚁的<击> EXEC 申请任务。

You could use the antrun plugin. Inside you would use ant's exec apply task.

这样的事情。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.2</version>
    <executions>
      <execution>
        <phase> <!-- a lifecycle phase --> </phase>
        <configuration>

          <tasks>
            <apply os="unix" executable="cmd">
              <arg value="/c"/>
              <arg value="ant.bat"/>
              <arg value="-p"/>
            </apply>
            <apply os="windows" executable="cmd.exe">
              <arg value="/c"/>
              <arg value="ant.bat"/>
              <arg value="-p"/>
            </apply>
          </tasks>

        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

<击>当然蚂蚁支持的操作系统特定的命令通过条件任务

这篇关于在Maven的集成测试期间启动外部进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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