How maven pom.xml identifies the testng test cases in a non-standard project structure?(maven pom.xml 如何识别非标准项目结构中的 testng 测试用例?)
问题描述
我对 maven 和 testng 完全陌生.我使用 maven 作为构建工具,并使用 testng 作为我的测试框架.我没有遵循标准的 Maven 项目结构.现在我希望我的 pom.xml 在我的项目中执行测试用例.问题是,pom.xml 如何知道要考虑执行哪些测试用例?
如果你把它放在一个地方,你需要设置 maven-surefire-plugin 配置的 testClassesDirectory 参数:
<代码><项目>[...]<构建><插件><插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><版本>2.17</版本><配置><testClassesDirectory>路径/到/编译的测试类</testClassesDirectory></配置></插件></插件></构建>[...]</项目>
所有这些都在 Maven Surefire 插件文档中详细记录了p>
I am completely new to maven and testng. I am using maven as build tool, and testng as my testing framework. I am not following the standard maven project structure. Now I want my pom.xml to execute the test cases in my project. The question is, how pom.xml knows what are the test cases to consider for execution?
If you keep this in a single place you need to set the testClassesDirectory argument of the maven-surefire-plugin configuration:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<testClassesDirectory>path/to/compiled test classes</testClassesDirectory>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
All of this is well documented in the Maven Surefire Plugin Documentation
这篇关于maven pom.xml 如何识别非标准项目结构中的 testng 测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:maven pom.xml 如何识别非标准项目结构中的 testng 测试用例?
基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
