gpt4 book ai didi

java - 如何使用 Maven 组合并运行来自不同项目的 testng xml 文件?

转载 作者:太空宇宙 更新时间:2023-11-04 12:16:55 25 4
gpt4 key购买 nike

我有三个项目,每个项目都有 testng xml 文件。

项目A

testA.xml

项目B

testB.xml

项目C

testC.xml

对于单个项目,我使用以下命令运行测试:

mvn clean install -Dsurefire.suiteXmlFiles=testA.xml

我想合并并运行所有项目的测试。有没有办法实现这个目标?

最佳答案

在 pom.xml 中为 suiteXMlFile 创建一个变量,如下所示:

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${sources}</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
</configuration>

然后从命令行:

mvn clean install -Dsources=testA.xml,testB.xml,testC.xml

如果您想执行单个套件,请使用:

mvn clean install -Dsources=testA.xml

注意:套件 xml 的路径应该是绝对路径。

关于java - 如何使用 Maven 组合并运行来自不同项目的 testng xml 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39295675/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com