问题描述
我对 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 测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)