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 测试用例?


- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01