gpt4 book ai didi

maven - 通过命令行使用 Maven 运行特定的 TestNG 套件

转载 作者:行者123 更新时间:2023-12-05 04:07:06 25 4
gpt4 key购买 nike

我正在尝试使用命令行在 Maven 中运行特定的 TestNG 套件。

我有两个不同的套房
烟雾.xml回归.xml

我的 pom.xml 文件是这样的

<groupId>com.FNB</groupId>
<artifactId>FNB_Testing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>FNB_Testing</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>/FNB_Testing/regression.xml</suiteXmlFile>
<suiteXmlFile>/FNB_Testing/smoke.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>

我正在使用命令 mvn test -DsuiteXmlFile=*suite name*

然而,即使使用了 somke.xml,它也只会运行回归套件

最佳答案

您可以像下面那样参数化多个套件文件

<suiteXmlFiles>
<!-- Pass testng.xml files as argument from command line -->
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>

然后执行以下命令使用 Maven 参数化多个 testng.xml 文件:

mvn clean test -Dsurefire.suiteXmlFiles=regression.xml,smoke.xml

关于maven - 通过命令行使用 Maven 运行特定的 TestNG 套件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48978243/

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