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


基础教程推荐
- Java:带有char数组的println给出乱码 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 降序排序:Java Map 2022-01-01