Starting external process during integration testing in maven(在 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 插件.在里面你会使用 ant 的 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>
Ant 支持 os 特定命令当然是通过 条件任务.
这篇关于在 Maven 集成测试期间启动外部进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Maven 集成测试期间启动外部进程
基础教程推荐
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
